Skip to content

Commit

Permalink
fix: typescript requests always cancel since occur watch files change…
Browse files Browse the repository at this point in the history
…d event

close #2254, close #2190
  • Loading branch information
johnsoncodehk committed Dec 26, 2022
1 parent 4962d72 commit 697b22a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/language-server/src/common/project.ts
Expand Up @@ -62,6 +62,7 @@ export async function createProject(params: ProjectParams) {
if (!parsedCommandLine.fileNames.includes(fileName)) {
parsedCommandLine.fileNames.push(fileName);
projectVersion++;
projectVersionUpdateTime = cancelTokenHost.getMtime();
}
},
dispose,
Expand Down Expand Up @@ -103,6 +104,8 @@ export async function createProject(params: ProjectParams) {
}
async function onWorkspaceFilesChanged(changes: vscode.FileEvent[]) {

const _projectVersion = projectVersion;

for (const change of changes) {

const script = scripts.uriGet(change.uri);
Expand Down Expand Up @@ -132,6 +135,10 @@ export async function createProject(params: ProjectParams) {
projectVersion++;
typeRootVersion++;
}

if (_projectVersion !== projectVersion) {
projectVersionUpdateTime = cancelTokenHost.getMtime();
}
}
function createLanguageServiceHost() {

Expand Down

0 comments on commit 697b22a

Please sign in to comment.