Make it possible to cancel requests to get diagnostics.#3561
Conversation
Conflicts: src/compiler/checker.ts src/compiler/program.ts src/compiler/types.ts src/services/services.ts
There was a problem hiding this comment.
why are we passing a cancellation token here. the program has access to the host, and the host has a cancellation token already.
Conflicts: src/services/services.ts src/services/shims.ts
Make it possible to cancel requests to get diagnostics.
|
Assume I queue an operation on a large file, and cancel half way through. Would that make subsequent operations any faster? I understand majority of the caching is thrown away on cancellation. But is it a majority or all of it? Say, do you keep any parsing state, identifier/string tables etc.? |
|
The only thing that can be cancelled here is getting errors, which triggers a type check of the program. When that is cancelled, the type checker and all objects it created are thrown away. The parse trees and interned string tables are not associated with the type checker, so those stick around. But keep in mind that the most common reason for cancellation is an edit, so there may be other things that get discarded as a result of the edit. |
|
@CyrusNajmabadi why was that merged. i have not signed off on it, nor have we discussed it in person! |
If a diagnostic request is actually canceled, we will throw away the type checker as we cannot be certain that it is still in a usable state.
I recommend reviewing this with ?w=1 to make the diff easier to understand.