-
Notifications
You must be signed in to change notification settings - Fork 844
Cancellation support for lexing and parsing ops in language service features #15683
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
Cancellation support for lexing and parsing ops in language service features #15683
Conversation
Yeah, currently, if you call getDefaultCancellationToken, it will return one which was passed to the topmost cancellableTask. Thinking about it. It should be renamed. To just "cancellationToken". |
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.
It'd be interesting to see if there's a measurable change when parsing a big file, like CheckExpressions.fs, but otherwise cancellation is good to have in any case, thanks!
…-parsing-operations-esp-in-language-service-features
This adds support for cancellation during lexing+parsing.
This does not affect the code path being taken by standalone compiler (that ones goes via
ParseOneInputLexbufat ParseAndCheckInputs.fs ;; which was not modified).The cancellation token flows from higher-level operations which were already
async{}before, this extracts thelet! ct = Async.CancellationTokenfrom it.(cc @vzarytovskii This does mean that if operations inside Compiler.Service will be redone from async to cancellableTask, the token extraction must be also adjusted)
I tested this in VS, the operation was being cancelled under quick typing (before I adjusted the exception handlers to correctly handle the cancelled exn, it was all going into VS activity log and/or showing up an alert dialog)