Skip to content

Commit

Permalink
feat: add diagnostics delay setting
Browse files Browse the repository at this point in the history
close #1295
  • Loading branch information
johnsoncodehk committed Jul 16, 2022
1 parent 768e649 commit 0f43937
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions extensions/vscode-vue-language-features/package.json
Expand Up @@ -444,6 +444,11 @@
"type": "boolean",
"default": true,
"description": "Enabled update imports on file move."
},
"volar.diagnostics.delay": {
"type": "number",
"default": 200,
"description": "Delay time for diagnostics."
}
}
},
Expand Down
9 changes: 4 additions & 5 deletions packages/vue-language-server/src/projects.ts
Expand Up @@ -116,8 +116,6 @@ export function createProjects(
}
});

updateDiagnostics(undefined);

return {
workspaces,
getProject,
Expand All @@ -129,8 +127,6 @@ export function createProjects(

await updateDiagnostics(driveFileName ? shared.fsPathToUri(driveFileName) : undefined);

await shared.sleep(100);

if (req === semanticTokensReq) {
if (options.languageFeatures?.semanticTokens) {
connection.languages.semanticTokens.refresh();
Expand All @@ -150,8 +146,9 @@ export function createProjects(
}

const req = ++documentUpdatedReq;
const delay = await lsConfigs?.getConfiguration<number>('volar.diagnostics.delay');

await shared.sleep(100);
await shared.sleep(delay ?? 200);

if (req !== documentUpdatedReq)
return;
Expand Down Expand Up @@ -181,6 +178,8 @@ export function createProjects(

for (const doc of otherDocs) {

await shared.sleep(delay ?? 200);

if (req !== documentUpdatedReq)
return;

Expand Down

0 comments on commit 0f43937

Please sign in to comment.