microsoft / TypeScript-TmLanguage

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

Wrong scope "support.variable.property.dom" #879

Open sultan-ov opened 2 years ago

sultan-ov commented 2 years ago

Properties of my own object fall under the scope of "support.variable.property.dom":

screenshot_wrong_scope_1

This covers a significant number of commonly used words:

screenshot_wrong_scope_2

This clearly looks like a bug. I cannot fix this in my color scheme for example by changing the "foreground" to my normal property color because if I define "name" property as a functional expression it still falls under "support.variable.property.dom" and does not change to "entity.name.function" as it happens with normal properties and as a result is not colored in my function color:

screenshot_wrong_scope_3

screenshot_wrong_scope_4

orta commented 2 years ago

I think we might take a PR which makes some of these properties only get property.dom applied if they are used without a . beforehand. It looks like adding this pre-dates the tmlanguage living in this repo, so at this point I'm not sure the reasoning for having them built the way they are - so the PR will need to be well tested 👍🏻

sultan-ov commented 2 years ago

"support.variable.property.dom" scope checks if the property of any object matches the properties of the DOM element object, which in itself is a bad idea.

The only sensible solution I see is to erase this scope.

sultan-ov commented 2 years ago

Why do you need these properties without the dot accessor? In such a scenario, they cease to be properties of the DOM element object.