@@ -33,7 +33,7 @@ export interface IGrammar {
33
33
/**
34
34
* Tokenize `lineText` using previous line state `prevState`.
35
35
*/
36
- tokenizeLine ( lineText : string , prevState : StackElement | null ) : ITokenizeLineResult ;
36
+ tokenizeLine ( lineText : string , prevState : StackElement | null , timeLimit ?: number ) : ITokenizeLineResult ;
37
37
/**
38
38
* Tokenize `lineText` using previous line state `prevState`.
39
39
* The result contains the tokens in binary format, resolved with the following information:
@@ -44,14 +44,18 @@ export interface IGrammar {
44
44
* - background color
45
45
* e.g. for getting the languageId: `(metadata & MetadataConsts.LANGUAGEID_MASK) >>> MetadataConsts.LANGUAGEID_OFFSET`
46
46
*/
47
- tokenizeLine2 ( lineText : string , prevState : StackElement | null ) : ITokenizeLineResult2 ;
47
+ tokenizeLine2 ( lineText : string , prevState : StackElement | null , timeLimit ?: number ) : ITokenizeLineResult2 ;
48
48
}
49
49
export interface ITokenizeLineResult {
50
50
readonly tokens : IToken [ ] ;
51
51
/**
52
52
* The `prevState` to be passed on to the next line tokenization.
53
53
*/
54
54
readonly ruleStack : StackElement ;
55
+ /**
56
+ * Did tokenization stop early due to reaching the time limit.
57
+ */
58
+ readonly stoppedEarly : boolean ;
55
59
}
56
60
/**
57
61
* Helpers to manage the "collapsed" metadata of an entire StackElement stack.
@@ -97,6 +101,10 @@ export interface ITokenizeLineResult2 {
97
101
* The `prevState` to be passed on to the next line tokenization.
98
102
*/
99
103
readonly ruleStack : StackElement ;
104
+ /**
105
+ * Did tokenization stop early due to reaching the time limit.
106
+ */
107
+ readonly stoppedEarly : boolean ;
100
108
}
101
109
export interface IToken {
102
110
startIndex : number ;
0 commit comments