-
-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop computing outdated diagnostics with CancellationToken #2332
Conversation
I think we can't forward that cancellation token to TS Server for completion. In addition, |
...program.getDeclarationDiagnostics(sourceFile, cancellationToken?.tsToken) | ||
]; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dedc2a5
to
5834eb2
Compare
When this PR merged:
|
|
5834eb2
to
5c43502
Compare
I made a retarded mistake, and I've fixed it. |
3f8fc71
to
290f03c
Compare
get token(): VCancellationToken { | ||
const token = super.token as VCancellationToken; | ||
// tslint:disable-next-line variable-name | ||
const Exception = this.tsModule.OperationCanceledException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to do this assignment + TSLint rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be my mistake.
I read the tslint rules wrong.
server/src/services/vls.ts
Outdated
@@ -176,7 +179,7 @@ export class VLS { | |||
this.lspConnection.onRequest('$/getDiagnostics', params => { | |||
const doc = this.documentService.getDocument(params.uri); | |||
if (doc) { | |||
return this.doValidate(doc); | |||
return this.doValidate(doc).then(result => result ?? []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this callback async for readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example add async
in function?
} | ||
} | ||
|
||
export function isVCancellationTokenCancel(token?: VCancellationToken) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call this isVCancellationRequested
(or isVCancellationRequestedOnToken
if you prefer)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isVCancellationRequested
is great.
Thanks.
]; | ||
|
||
const compilerOptions = program.getCompilerOptions(); | ||
if (!!(compilerOptions.declaration || compilerOptions.composite)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the result is undefined this block won't execute, so I think it's unnecessary convert it to Boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember it is resolve type error.
290f03c
to
3affd7d
Compare
Fixed #1263
Fix a part of #2192