Monokai / monokai-pro-vscode

Issue tracking for Monokai Pro for Visual Studio Code
321 stars 8 forks source link

TypeScript generic type arguments are highly affected by whitespace and other irrelevant context #372

Closed lionel-rowe closed 6 months ago

lionel-rowe commented 10 months ago

Examples:

Declaring a function signature with generics seems to be pretty robust to changes in whitespace and surrounding context, but passing type arguments is extremely brittle.

image

Expected:

Code:

declare function abc<A, B, C>(): unknown

const abc2 = abc<1, 2, 3>
const abc3 = abc<X, Y, Z>
const abc4 = abc<
    1,
    2,
    3
>
const abc5 = abc<
    X,
    Y,
    Z
>

const result1 = abc<1, 2, 3>()

const result2 = abc<
    1,
    2,
    3
>()

const result3 = abc<X, Y, Z>()

const result4 = abc<
    X,
    Y,
    Z
>()

const arr = [
    abc<1, 2, 3>(),
    abc<
        1,
        2,
        3
    >(),
    abc<X, Y, Z>(),
    abc<
        X,
        Y,
        Z
    >(),
]

const obj = {
    result1: abc<1, 2, 3> (),
    result2: abc<
        1,
        2,
        3
    >(),
    result3: abc<X, Y, Z>(),
    result4: abc<
        X,
        Y,
        Z
    >(),
}
Monokai commented 6 months ago

Color schemes depend on syntax definitions to give colors to different tokens. In this case, the token of abc with linebreaks is not correctly recognized as a function call. Unfortunately color schemes like Monokai Pro can't color those correctly. Best to take it up with the TypeScript package.