diff options
Diffstat (limited to 'src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.ts')
-rw-r--r-- | src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.ts b/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.ts index 0c572140a2d..c65a57b0175 100644 --- a/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.ts +++ b/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.ts @@ -54,7 +54,10 @@ export interface ITokenizerSource { getValue(): string; getLineCount(): number; getLineLength(lineNumber: number): number; - getLineTokens(lineNumber: number): IViewLineTokens; + + tokenization: { + getLineTokens(lineNumber: number): IViewLineTokens; + }; } export class TextBufferTokenizer implements Tokenizer { @@ -166,7 +169,7 @@ class NonPeekableTextBufferTokenizer { } if (this.line === null) { - this.lineTokens = this.textModel.getLineTokens(this.lineIdx + 1); + this.lineTokens = this.textModel.tokenization.getLineTokens(this.lineIdx + 1); this.line = this.lineTokens.getLineContent(); this.lineTokenOffset = this.lineCharOffset === 0 ? 0 : this.lineTokens!.findTokenIndexAtOffset(this.lineCharOffset); } @@ -192,10 +195,11 @@ class NonPeekableTextBufferTokenizer { } const isOther = TokenMetadata.getTokenType(tokenMetadata) === StandardTokenType.Other; + const containsBracketType = TokenMetadata.containsBalancedBrackets(tokenMetadata); const endOffset = lineTokens.getEndOffset(this.lineTokenOffset); // Is there a bracket token next? Only consume text. - if (isOther && endOffset !== this.lineCharOffset) { + if (containsBracketType && isOther && endOffset !== this.lineCharOffset) { const languageId = lineTokens.getLanguageId(this.lineTokenOffset); const text = this.line.substring(this.lineCharOffset, endOffset); @@ -238,7 +242,7 @@ class NonPeekableTextBufferTokenizer { break; } this.lineIdx++; - this.lineTokens = this.textModel.getLineTokens(this.lineIdx + 1); + this.lineTokens = this.textModel.tokenization.getLineTokens(this.lineIdx + 1); this.lineTokenOffset = 0; this.line = this.lineTokens.getLineContent(); this.lineCharOffset = 0; @@ -276,7 +280,7 @@ export class FastTokenizer implements Tokenizer { constructor(private readonly text: string, brackets: BracketTokens) { const regExpStr = brackets.getRegExpStr(); - const regexp = regExpStr ? new RegExp(brackets.getRegExpStr() + '|\n', 'g') : null; + const regexp = regExpStr ? new RegExp(regExpStr + '|\n', 'gi') : null; const tokens: Token[] = []; |