nim-lang / NimLime

The official Nim programming language plugin for Sublime Text
MIT License
132 stars 34 forks source link

Weird highlights #182

Closed georgelemon closed 11 months ago

georgelemon commented 1 year ago

Words like find, contains should not be highlighted. Maybe there are more like this.

Screenshot from 2023-09-27 07-48-53

Also, echo used to be part of keyword.control.

AmjadHD commented 1 year ago

They are highlighted because they are builtins i.e available in the system module.

Also, echo used to be part of keyword.control.

echo is not a keyword.

georgelemon commented 1 year ago

Alright. Then, find in that context is a valid name for a package so it should not be highlighted. LSP can print info about std libs. Complicating the syntax with useless regex is too much (never used LSP).

Araq commented 1 year ago

They are highlighted because they are builtins i.e available in the system module.

That set keeps changing and depends on the used mode too, some things are not supported by nim js, for example. Also, the highlighter never knows if the "builtin" symbol wasn't shadowed. "builtin" is not a useful category for Nim and should be abolished.

AmjadHD commented 1 year ago

That set keeps changing and depends on the used mode too, some things are not supported by nim js, for example. Also, the highlighter never knows if the "builtin" symbol wasn't shadowed.

It doesn't matter, it's not meant to be an exhaustive list it's just to give a somewhat good idea about the builtin namespace. Many don't use IDEs (and LSP for that matter) removing builtin highlighting means a bad experience for them. I try to follow the norms of each tool, Sublime syntax definitions highlight builtins so I do, Github's don't so I don't.

Araq commented 1 year ago

Wrong highlighting that does not reflect reality does not help anybody. Highlighting in general is overdone with too many different colors that nobody understands anyway. The distinction between keywords and non-keywords is all that matters. Then you also highlight string literals and comments differently and you covered 100% of what is actually useful.

Turbo Pascal did that effectively and bugfree in 1988...