diff --git a/src/server.ts b/src/server.ts index 4f437755..9203a066 100644 --- a/src/server.ts +++ b/src/server.ts @@ -52,7 +52,7 @@ connection.onInitialize( storageService = new StorageService(); scannerService = new ScannerService(storageService, settings); - const files = await findFiles('**/*.{scss,vue}', { + const files = await findFiles('**/*.scss', { cwd: params.rootPath, deep: settings.scannerDepth, ignore: settings.scannerExclude diff --git a/src/services/scanner.ts b/src/services/scanner.ts index 4b3cdc3c..e59e21db 100644 --- a/src/services/scanner.ts +++ b/src/services/scanner.ts @@ -6,7 +6,6 @@ import { ISettings } from '../types/settings'; import { readFile, fileExists } from '../utils/fs'; import { parseDocument } from './parser'; import StorageService from './storage'; -import { isVueFile, getVueSCSSContent } from '../utils/vue'; export default class ScannerService { constructor(private readonly _storage: StorageService, private readonly _settings: ISettings) {} @@ -38,12 +37,7 @@ export default class ScannerService { } const content = await this._readFile(filepath); - const document = TextDocument.create( - originalFilepath, - 'scss', - 1, - isVueFile(filepath) ? getVueSCSSContent(content) : content - ); + const document = TextDocument.create(originalFilepath, 'scss', 1, content); const { symbols } = parseDocument(document, null); this._storage.set(filepath, { ...symbols, filepath }); diff --git a/src/test/services/scanner.spec.ts b/src/test/services/scanner.spec.ts index f00a95e5..25e296ae 100644 --- a/src/test/services/scanner.spec.ts +++ b/src/test/services/scanner.spec.ts @@ -31,16 +31,15 @@ describe('Services/Scanner', () => { scanner.fileExistsStub.resolves(true); scanner.readFileStub.onFirstCall().resolves('$name: value;'); scanner.readFileStub.onSecondCall().resolves(''); - scanner.readFileStub.onThirdCall().resolves(''); - await scanner.scan(['index.scss', 'variables.scss', 'AppButton.vue']); + await scanner.scan(['index.scss', 'variables.scss']); - assert.deepStrictEqual(storage.keys(), ['index.scss', 'variables.scss', 'AppButton.vue']); + assert.deepStrictEqual(storage.keys(), ['index.scss', 'variables.scss']); assert.ok(storage.get('index.scss')); assert.strictEqual(storage.get('index.scss').variables.length, 1); - assert.strictEqual(scanner.fileExistsStub.callCount, 3); - assert.strictEqual(scanner.readFileStub.callCount, 3); + assert.strictEqual(scanner.fileExistsStub.callCount, 2); + assert.strictEqual(scanner.readFileStub.callCount, 2); }); it('should find file and imported files', async () => { @@ -60,30 +59,6 @@ describe('Services/Scanner', () => { assert.strictEqual(scanner.readFileStub.callCount, 2); }); - it('should find vue file and imported scss files', async () => { - const storage = new StorageService(); - const settings = helpers.makeSettings(); - const scanner = new ScannerServiceTest(storage, settings); - - scanner.fileExistsStub.resolves(true); - scanner.readFileStub.onFirstCall().resolves(` - - `); - scanner.readFileStub.onSecondCall().resolves(''); - scanner.readFileStub.onThirdCall().resolves(''); - - await scanner.scan(['AppButton.vue']); - - assert.deepStrictEqual(storage.keys(), ['AppButton.vue', 'variables.scss']); - - assert.strictEqual(scanner.fileExistsStub.callCount, 2); - assert.strictEqual(scanner.readFileStub.callCount, 2); - }); - it('should do not find imported files when it not required', async () => { const storage = new StorageService(); const settings = helpers.makeSettings({ scanImportedFiles: false }); @@ -101,29 +76,6 @@ describe('Services/Scanner', () => { assert.strictEqual(scanner.readFileStub.callCount, 1); }); - it('should vue file do not find imported files when it not required', async () => { - const storage = new StorageService(); - const settings = helpers.makeSettings({ scanImportedFiles: false }); - const scanner = new ScannerServiceTest(storage, settings); - - scanner.fileExistsStub.resolves(true); - scanner.readFileStub.onFirstCall().resolves(` - - `); - scanner.readFileStub.onSecondCall().resolves(''); - - await scanner.scan(['AppButton.vue']); - - assert.deepStrictEqual(storage.keys(), ['AppButton.vue']); - - assert.strictEqual(scanner.fileExistsStub.callCount, 1); - assert.strictEqual(scanner.readFileStub.callCount, 1); - }); - it('should do not find imported files when the recursive mode is no required', async () => { const storage = new StorageService(); const settings = helpers.makeSettings();