Skip to content

Commit d2336f0

Browse files
kyliauayazhafiz
authored andcommitted
fix: always use projSvc.getDefaultProjectForScriptInfo (#390)
`scriptInfo.getDefaultProject()` will throw if it does not have any containing project, thus it should not be used. This could occur if only HTML file is opened in the editor, and `openClientFile()` does not return the config file name.
1 parent bf8586b commit d2336f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/src/server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ connection.onDidChangeTextDocument((params: lsp.DidChangeTextDocumentParams) =>
128128
}
129129
}
130130

131-
const project = scriptInfo.getDefaultProject();
131+
const project = projSvc.getDefaultProjectForScriptInfo(scriptInfo);
132+
if (!project) {
133+
return;
134+
}
132135
project.refreshDiagnostics();
133136
});
134137

0 commit comments

Comments
 (0)