aeschli / typescript-vscode-sh-plugin

TypeScript plugin that proves richer semantic highlighing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Constant and Support Function not classified in new Semantic Highlighting

GulajavaMinistudio opened this issue · comments

In JavaScript with semantic highlighting, require function is classified as variable.readwrite . This is false .
Screenshot_2020-03-15_14-37-19

require function should be classifield as support function, like this one, without semantic highlighting turned on.
Screenshot_2020-03-15_14-38-16

Also there is no classification for support.constant scope . In JavaScript or Typescript, there is some constant variable with function. Such as JSON.parse() , or JSON.stringify, and Math.random and Object.assign()
Screenshot_2020-03-15_14-39-44

hi @GulajavaMinistudio - I'm sorry I'm linking to an issue I created myself, but I think you might be interested, since it's very related to this one: microsoft/vscode#91168

The TL,DR is that this is, sadly, the intended behavior, although I hope that as more features are added these cases would be better covered / more consistent, or allow users to configure it via separate tokens or modifiers, as you suggested too.

In @types/... declaration files, the require function is declared as a variable and its type has extra non-native properties, so they consider its "main purpose" to be unknown, and as a result it's not semantically tagged as a function anymore.
This was apparently done in the first place to make it so that Object doesn't get colored like a function.

Tracked in microsoft/vscode#91090

We now use support constant and function fro all default library symbols.

However: require is not a default library symbol, it's just a regular referenced library.
Example for default library symbols are Math, String, ..