microsoft / TypeScript-TmLanguage

TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
MIT License
415 stars 130 forks source link

All greater-than signs (>) marked as "unmatched brackets" even when not part of a bracketed expression #936

Closed Jessidhia closed 1 year ago

Jessidhia commented 2 years ago

TS and JS Grammar Extension version: 0.0.55 / latest

Code

const test = () => 1 > 2

("Dark+ (default dark)" theme, Cascadia Code font (but happens on any font))

image

Both > tokens are marked as unmatched brackets and colorized red; the first > is part of the => token, the second is an ordinary > operator. Disabling the ms-vscode.typescript-javascript-grammar fixes the highlighting and shows no errors, as does disabling editor.bracketPairColorization.enabled as that simply disables any kind of colorization.

c.f. https://github.com/microsoft/vscode/issues/157322

While this manifests as the unexpected-closing-bracket class being added to spans containing the > character, the "Developer: Inspect Editor Tokens and Scopes" tool still shows => as a single token, both with the same foreground color value. It's only .monaco-editor .unexpected-closing-bracket that then colors it red.

Note also that 1 < 2 > 3 doesn't get colorized as mismatched brackets because it thinks the < operator is the start of a bracketed expression.

sheetalkamat commented 1 year ago

Does not repro image