Skip to content

Commit c29bdb2

Browse files
committed
fix: don't active intellisense for .md and '.html' if not set in include in tsconfig
1 parent 981af69 commit c29bdb2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/vue-language-server/src/project.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,11 @@ export async function createProject(
240240
scripts.clear();
241241
}
242242
function createParsedCommandLine(): ReturnType<typeof tsShared.createParsedCommandLine> {
243+
const extraExts = typeof tsConfig === 'string' ? ['.vue', '.md', '.html'] : ['.vue'];
243244
const parseConfigHost: ts.ParseConfigHost = {
244245
useCaseSensitiveFileNames: projectSys.useCaseSensitiveFileNames,
245246
readDirectory: (path, extensions, exclude, include, depth) => {
246-
return projectSys.readDirectory(path, [...extensions, '.vue', '.md', '.html'], exclude, include, depth);
247+
return projectSys.readDirectory(path, [...extensions, ...extraExts], exclude, include, depth);
247248
},
248249
fileExists: projectSys.fileExists,
249250
readFile: projectSys.readFile,

packages/vue-language-service/src/languageService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export function createLanguageService(
313313
function getTextDocument(uri: string) {
314314

315315
const fileName = shared.uriToFsPath(uri);
316-
const scriptSnapshot = vueLsHost.getScriptSnapshot(fileName);
316+
const scriptSnapshot = vueLsHost.getScriptFileNames().includes(fileName) ? vueLsHost.getScriptSnapshot(fileName) : undefined;
317317

318318
if (scriptSnapshot) {
319319

0 commit comments

Comments
 (0)