mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
Fixes #117264: Abandon tokenizing a line after 500ms if possible.
This commit is contained in:
@@ -484,7 +484,13 @@ class TMTokenization extends Disposable {
|
||||
}
|
||||
|
||||
public tokenize2(line: string, state: StackElement): TokenizationResult2 {
|
||||
let textMateResult = this._grammar.tokenizeLine2(line, state);
|
||||
const textMateResult = this._grammar.tokenizeLine2(line, state, 500);
|
||||
|
||||
if (textMateResult.stoppedEarly) {
|
||||
console.warn(`Time limit reached when tokenizing line: ${line.substring(0, 100)}`);
|
||||
// return the state at the beginning of the line
|
||||
return new TokenizationResult2(textMateResult.tokens, state);
|
||||
}
|
||||
|
||||
if (this._containsEmbeddedLanguages) {
|
||||
let seenLanguages = this._seenLanguages;
|
||||
|
||||
Reference in New Issue
Block a user