nickspoons / vim-cs

Official Vim Runtime Files for C#
9 stars 3 forks source link

Highlight the alias contextual keyword #30

Closed dkearns closed 2 years ago

dkearns commented 2 years ago

Limit the lookbehind to 16 chars. It's unlikely this is ever formatted with more than one whitespace char but this gives enough margin for extraneous whitespace while editing without the highlighting flickering on and off.

Matching \<extern\s\+alias\> highlights the intervening whitespace which annoys users with background highlighting of keywords.

nickspoons commented 2 years ago

LGTM.

I don't quite get what you mean about highlighting flickering but I'm happy with this when you are.

dkearns commented 2 years ago

If we limit the lookbehind to only allow one WS char between extern and alias then if there's anymore than that, perhaps just temporarily while editing, we lose highlighting of alias. An 'unrestricted' lookbehind can be slow but, as a compromise, allowing for half a dozen or so WS chars makes them feel more like independent keywords when editing.

I find this sort of thing sometimes trips me up in unfamiliar languages.

nickspoons commented 2 years ago

OK that's sensible, thanks