diff --git a/server/src/modes/vue/snippets.ts b/server/src/modes/vue/snippets.ts index 55a5711417..d8e75f7eeb 100644 --- a/server/src/modes/vue/snippets.ts +++ b/server/src/modes/vue/snippets.ts @@ -78,6 +78,9 @@ function loadAllSnippets(rootDir: string, source: SnippetSource): Snippet[] { try { fs.readdirSync(rootDir).forEach(p => { + if (p === 'template' || p === 'style' || p === 'script') { + return; + } const absPath = path.resolve(rootDir, p); if (!absPath.endsWith('.vue') && fs.existsSync(absPath) && fs.lstatSync(absPath).isDirectory()) { const customDirSnippets = loadSnippetsFromDir(absPath, source, 'custom').map(s => { diff --git a/test/lsp/completion/scaffold.test.ts b/test/lsp/completion/scaffold.test.ts new file mode 100644 index 0000000000..76b5364492 --- /dev/null +++ b/test/lsp/completion/scaffold.test.ts @@ -0,0 +1,45 @@ +import { activateLS, showFile, sleep, FILE_LOAD_SLEEP_TIME } from '../helper'; +import { position, getDocUri } from '../util'; +import { testCompletion } from './helper'; + +describe('Should autocomplete scaffold snippets', () => { + const scriptDocUri = getDocUri('client/completion/script/Scaffold.vue'); + + before('activate', async () => { + await activateLS(); + await showFile(scriptDocUri); + await sleep(FILE_LOAD_SLEEP_TIME); + // TS LS completion starts slow. + await sleep(2000); + }); + + it('completes all scaffold snippets', async () => { + await testCompletion(scriptDocUri, position(0, 1), [ + ' with default.vue ✌', + '