Skip to content

Conversation

@clason
Copy link
Member

@clason clason commented Dec 19, 2023

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
Copy link
Member

Oh, thanks for doing this!

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

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
Copy link
Member Author

clason commented Dec 19, 2023

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).

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?`.
@clason clason requested a review from justinmk December 19, 2023 23:17
@clason clason merged commit 4f8ba9e into master Dec 21, 2023
@clason clason deleted the feat/notes branch December 21, 2023 11:57
@echasnovski
Copy link
Member

Thanks, Christian!

note: () => choice(
'Note:', 'NOTE:', 'Notes:',
'Warning:', 'WARNING:',
'Deprecated', 'DEPRECATED:'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also Experimental:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wasn't part of the OG syntax file.

We can consider this if we officially stop trailing vimdox in favor of our own "nvimdoc" (i.e. a more strictly specified dialect).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we can use Warning: instead of Experimental:.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants