microsoft / TypeScript-TmLanguage

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

Square + Round braces to have different TextMate scope if its in type #925

Closed TamirCode closed 1 year ago

TamirCode commented 1 year ago

I need the braces/brackets to be a different color if they are part of type declarations, but there is no way to differentiate them from normal braces/brackets because they have the same TextMate scope. I am requesting a more specific scope that lets me target the ones in type declarations (as underlined in red in the screenshot bellow)

underlined in red are the braces in type declarations relevant to typescript underlined in blue are braces that are irrelevant to types. image Both red and blue have the same TextMate scopes corresponding to round/square. their textmate scopes are meta.brace.square.ts and meta.brace.round.ts I would like more specific scopes to target the red (those relevant to types) so we would have more specific scope like meta.brace.square.type.ts and meta.brace.round.type.ts for the reds, and the normal ones will keep their TextMate as is.

Code to reproduce

function myFunction(str: string): void {
    console.log(str)
}

let myArr: string[] = ["blah", "blah"]

let myArr2: (string | number)[] = ["blah", 78]

myFunction("123")
TamirCode commented 1 year ago

nvm I used meta.type.annotation.ts scope