nickspoons / vim-cs

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

Highlight the new type in all type declarations #54

Open dkearns opened 2 years ago

dkearns commented 2 years ago

This feature seems to predate your work @nickspoons and I'm wondering about its history. Is there something special about class type declarations that I'm overlooking or were the others just not done yet?

The current csClassType implementation doesn't interact all that well with the omnisharp-vim highlighting of types as it still highlights any punctuation chars as csClassType whereas they are usually not highlighted. We could match contained punctuation chars in the various type groups but perhaps it's supposed to be a single region colour to standout.

I'm not sure highlighting these declared types specially like this is worth the trouble in general. I suspect no one has really noticed the special casing of class declarations as types are more uniformly highlighted with OSV and the only difference is the punctuation chars in type parameter lists.

Anyway, this is a quick crack at supporting it for all type declarations (except records).

nickspoons commented 2 years ago

Hi @dkearns,

This looks pretty good, nice to make these type declarations consistent. I'm away from the computer for a few more days so haven't seen the results exactly but from the tests it looks very sensible.

Yes the class type declarations were there before I was involved, I suspect that class was just the most common of the type declarations and therefore deemed most important.