Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

impose timeout when running tokenizeLine2() #39

wants to merge 3 commits into from

Conversation

bolinfest
Copy link
Owner

@bolinfest bolinfest commented Nov 11, 2022

@@ -152,6 +152,8 @@ export class SimpleLanguageInfoProvider {
}
}

const TOKENIZE_TIMEOUT_MS = 500;
Copy link
Collaborator

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?

Copy link
Owner Author

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};
Copy link
Collaborator

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?

Copy link
Owner Author

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;
Copy link

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?

Copy link
Owner Author

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!

Repository owner locked as resolved and limited conversation to collaborators Nov 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants