Description
I think current capture / highlighting groups are somewhat vague & need to be divided more precisely.
E.g. currently :
-
variable declaration & variable used in code share the same group
@variable
. They could be separate -@variable
&@declaration
or something like that. -
All types of brackets, braces & parens share the same group
@punctuation.bracket
. They could be separate -@punctuation.paren
,@punctuation.brace
, etc. -
Object key (when defining) & property (when using) have the same group
@property
. One more could be added like@object.key
. -
try & catch keyword share the same group
@exception
. They could be separate -@exception.try
&@exception.catch
-
import & from keyword share the same group
@include
. They could be separates@include.import
,@include.from
. There are many more vague keywords. -
Regular strings & backtick (template strings) share the same group
@string
. One more could be added -@string.template
. -
....
Why
Doing this will allow user to create more precise highlighting of the code. For e.g. one could make try block in green color, & catch block in red. As catch only executes when try block produces errors. Different uses have different taste, so this will allow users to highlight each part of code exactly as they want.
Lot of traditional syntax highlighting file (e.g. vim-javascript) provide these kinds of precisions & allows better control over code highlighting. The mentioned syntax file even provides separate groups for braces of objects, function, conditionals, etc.