-
Notifications
You must be signed in to change notification settings - Fork 31
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
impose timeout when running tokenizeLine2() #39
base: main
Are you sure you want to change the base?
Conversation
@@ -152,6 +152,8 @@ export class SimpleLanguageInfoProvider { | |||
} | |||
} | |||
|
|||
const TOKENIZE_TIMEOUT_MS = 500; |
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.
Could you please add a comment to explain how this is used?
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.
Good idea: included a link.
|
||
// This is the strategy used by VS Code: | ||
if (tokenizeLineResult2.stoppedEarly) { | ||
return {tokens: tokenizeLineResult2.tokens, endState: state}; |
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.
Should we log when this happens?
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.
Added!
* up the main thread. Note this is used in VS Code: | ||
* https://github.com/microsoft/vscode/blob/504c5a768a001b2099dd2b44e9dc39e10ccdfb56/src/vs/workbench/services/textMate/common/TMTokenization.ts#L39 | ||
*/ | ||
const TOKENIZE_TIMEOUT_MS = 500; |
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.
Should this timeout be configurable?
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.
Good idea: will address in a follow-up diff!
Stack created with [Sapling]
impose timeout when running tokenizeLine2()