neovim / tree-sitter-vimdoc

Tree-sitter parser for Vim help files
Apache License 2.0
97 stars 13 forks source link

feat: add `(note)` node for highlighted notes and warnings #115

Closed clason closed 8 months ago

clason commented 8 months ago

Add support for highlighting common call-out terms in documentation, like the legacy syntax's helpNote, helpWarning, helpDeprecated.

However, only the variants with a colon are supported, as these account for 99% of use in Nvim documentation without the danger of false positives (and to keep symbol count low).

To keep state count low, all these are parsed as a single (note) node that captures can disambiguate using #any-of?.

@echasnovski

echasnovski commented 8 months ago

Oh, thanks for doing this!

Haven't found time to sit down and have it done. Really glad you have :pray:

I didn't actually test it (because not really sure how to), but a list of what is captured as (note) seems more then reasonable to me.

So it also needs the default links for @text.note, @text.warning, and @text.danger in default color scheme, right?

clason commented 8 months ago

So it also needs the default links for @text.note, @text.warning, and @text.danger in default color scheme, right?

Well, in your colorscheme, whatever that may be, unless you don't want to see them ;) (They're standard nvim-treesitter captures, so any colorscheme that "supports" nvim-treesitter should have them.)

For the default colorscheme, I'd wait since these captures are due to be changed in nvim-treesitter (and after that in core).

echasnovski commented 8 months ago

Thanks, Christian!