microsoft / TypeScript-TmLanguage

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

Syntax highlighting for indexers doesn't work in classes #968

Closed relrelb closed 1 year ago

relrelb commented 1 year ago
interface I {
    [key: string]: any;
}

type T = {
    [key: string]: any;
};

class C {
    [key: string]: any;
}

The string keyword is highlighted correctly in the first 2 cases, but remains unhighlighted in the third case of class.

sheetalkamat commented 1 year ago

image

seems to work in vscode as well as baselines:

class C {
 ^^^^^
 source.ts meta.class.ts storage.type.class.ts
      ^
      source.ts meta.class.ts
       ^
       source.ts meta.class.ts entity.name.type.class.ts
        ^
        source.ts meta.class.ts
         ^
         source.ts meta.class.ts punctuation.definition.block.ts
>    [key: string]: any;
 ^^^^
 source.ts meta.class.ts meta.indexer.declaration.ts
     ^
     source.ts meta.class.ts meta.indexer.declaration.ts meta.brace.square.ts
      ^^^
      source.ts meta.class.ts meta.indexer.declaration.ts variable.parameter.ts
         ^
         source.ts meta.class.ts meta.indexer.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
          ^
          source.ts meta.class.ts meta.indexer.declaration.ts meta.type.annotation.ts
           ^^^^^^
           source.ts meta.class.ts meta.indexer.declaration.ts meta.type.annotation.ts support.type.primitive.ts
                 ^
                 source.ts meta.class.ts meta.indexer.declaration.ts meta.brace.square.ts
                  ^
                  source.ts meta.class.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
                   ^
                   source.ts meta.class.ts meta.type.annotation.ts
                    ^^^
                    source.ts meta.class.ts meta.type.annotation.ts support.type.primitive.ts
                       ^
                       source.ts meta.class.ts punctuation.terminator.statement.ts
>}
 ^
 source.ts meta.class.ts punctuation.definition.block.ts