microsoft / TypeScript-TmLanguage

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

[Bug] `instanceof` syntax highlighting is broken #985

Closed wenfangdu closed 1 year ago

wenfangdu commented 1 year ago

JavaScript and TypeScript Nightly version: 5.2.20230704

Code https://github.com/wenfangdu/vite-vue-3/blob/instanceof/src/App.vue#L7-L18 image

sheetalkamat commented 1 year ago

This isnt covered by the grammar in this repo.

wenfangdu commented 1 year ago

@sheetalkamat Could TypeScript-TmLanguage cover this syntax? If not, which repo is responsible for this?

douira commented 1 year ago

If the language allows this without erroring either the compiler is wrong or the highlighting is wrong. Some component in this has the responsibility to deal with this feature, either by requiring parentheses or by highlighting the permitted syntax. What does "This isn't covered by the grammar in this repo." mean? Does it mean such constructs are out of scope for this repo? If so, then why does vue language features not have anything to do with this, according to them?

johnsoncodehk commented 4 months ago

@sheetalkamat As far as I know, this problem cannot be solved in Vue's TM Language. But I found that the following changes to TypeScript-TmLanguage can solve most of the syntax issues we encountered in Vue template, I'm not sure if it's the right fix for this project.

https://github.com/johnsoncodehk/TypeScript-TmLanguage/commit/2e853d3f070319cecd77d03f3d06967ad586f532

douira commented 4 months ago

Since vue language tools can't fix it, the responsibility to deal with this evidently falls to the TS language grammar (this repo). Maybe you could just make a PR?

Fuzzyma commented 2 months ago

@sheetalkamat since you closed this and a fix seems to be available, what are the chances of reopening this and merging the fix?