microsoft / TypeScript-TmLanguage

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

Support "Arbitrary Module Namespace Identifiers" #1030

Closed evanw closed 1 month ago

evanw commented 6 months ago

This PR implements Arbitrary Module Namespace Identifiers, which is a JavaScript syntax feature that was added to JavaScript over two years ago (in ES2022). It allows import and export aliases to be strings instead of identifiers.

Before this PR:

Notice that the string content is incorrectly colored. In particular, the characters default in the middle of the string are confusingly highlighted as a keyword. The preceding type keyword is also not highlighted as a keyword when it should be.

After this PR:

All strings are highlighted as strings, and the type keyword is highlighted as a keyword.

evanw commented 1 month ago

Update: This syntax feature has now been added to TypeScript and shipped in VSCode. However, VSCode shipped it with broken syntax highlighting because this PR wasn't merged. Merging this PR would fix syntax highlighting for this feature.