microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.2k stars 28.86k forks source link

bracket pair highlight support for `<>` #144723

Closed tjx666 closed 2 years ago

tjx666 commented 2 years ago

Recently I did many typescript type excercises by https://github.com/type-challenges/type-challenges. I need to write many generic with <> bracket pair.

For example:

    Expect<Equal<UnionToIntersection<(() => 'foo') | ((i: 42) => true)>, (() => 'foo') & ((i: 42) => true)>>

I hard to regonize which part is the generic parameter for type UnionToIntersection.

I can recogonize the function part by put cursor bufore ( like:

image

But can't by put cursor before <:

image

@hediet

IllusionMH commented 2 years ago

This was intentionally disabled as <> breaks on many occasions as highlight is text based (for performance reasons). See #132476 and ton of duplicates for details. If you follow steps from https://github.com/microsoft/vscode/issues/131412 and enable it for TS you would get much worse result image

I guess that you should use extension that provides languages specific highlights if you prefer correctness/features over performance(main reason to implement it in editor).

tjx666 commented 2 years ago

Seems need ast to analyze the color pair in typescirpt for <>

hediet commented 2 years ago

In theory, the grammar could mark certain unbalanced occurences of < and > as a special token kind (like comment, string or regexp). Proper support is not planned at the moment.