Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow scanninng only specific location instead of whole workspace #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ Just install the plugin and use it.

## Supported settings

#### scss.scannerRoot

* Type: `string`
* Default: `""`

Set root directory for the scanner, relative to your workspace. `""` means whole workspace will be scanned. If your workspace has many .scss files unrelated to your current work, you should point the scanner to more specific location eg. `"themes/my-theme/src/scss"`.

#### scss.scannerDepth

* Type: `number`
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"contributes": {
"configuration": {
"properties": {
"scss.scannerRoot": {
"type": "string",
"default": "",
"description": "Set root directory for the scanner, relative to your workspace. `\"\"` means whole workspace will be scanned. If your workspace has many .scss files unrelated to your current work, you should point the scanner to more specific location eg. `\"themes/my-theme/src/scss\"`."
},
"scss.scannerDepth": {
"type": "number",
"default": 30,
Expand Down
3 changes: 2 additions & 1 deletion src/unsafe/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { searchWorkspaceSymbol } from './providers/workspaceSymbol';
import { findFiles } from './utils/fs';
import { getSCSSRegionsDocument } from './utils/vue';
import { URI } from 'vscode-uri';
import * as path from 'path';

interface InitializationOption {
workspace: string;
Expand Down Expand Up @@ -56,8 +57,8 @@ connection.onInitialize(
async (params: InitializeParams): Promise<InitializeResult> => {
const options = params.initializationOptions as InitializationOption;

workspaceRoot = options.workspace;
settings = options.settings;
workspaceRoot = path.join(options.workspace, settings.scannerRoot);

storageService = new StorageService();
scannerService = new ScannerService(storageService, settings);
Expand Down
1 change: 1 addition & 0 deletions src/unsafe/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function makeSameLineRange(line: number = 1, start: number = 1, end: numb

export function makeSettings(options?: Partial<ISettings>): ISettings {
return {
scannerRoot: '',
scannerDepth: 30,
scannerExclude: ['**/.git', '**/node_modules', '**/bower_components'],
scanImportedFiles: true,
Expand Down
1 change: 1 addition & 0 deletions src/unsafe/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export interface ISettings {
// Scanner
scannerRoot: string;
scannerDepth: number;
scannerExclude: string[];
scanImportedFiles: boolean;
Expand Down