Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion corpus/taglink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Note: ":autocmd" can...
(line)))
(block
(line
(word)
(note)
(word)
(word))
(line
Expand Down
44 changes: 44 additions & 0 deletions corpus/text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,47 @@ line
(block
(line
(word))))

================================================================================
notes
================================================================================
NOTE: this is a note

Note that this is not a note.

This is DEPRECATED:

This is not DEPRECATED.


--------------------------------------------------------------------------------

(help_file
(block
(line
(note)
(word)
(word)
(word)
(word)))
(block
(line
(word)
(word)
(word)
(word)
(word)
(word)
(word)))
(block
(line
(word)
(word)
(note)))
(block
(line
(word)
(word)
(word)
(word))))

7 changes: 7 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = grammar({
$.codespan,
$.argument,
$.keycode,
$.note,
),

// Explicit special cases: these are plaintext, not errors.
Expand Down Expand Up @@ -84,6 +85,12 @@ module.exports = grammar({
',',
),

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

),

keycode: () => choice(
/<[-a-zA-Z0-9_]+>/,
/<[SCMAD]-.>/,
Expand Down
6 changes: 6 additions & 0 deletions queries/help/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@
(argument) @parameter
(keycode) @string.special
(url) @text.uri
((note) @text.note
(#any-of? @text.note "Note:" "NOTE:" "Notes:"))
((note) @text.warning
(#any-of? @text.warning "Warning:" "WARNING:"))
((note) @text.danger
(#any-of? @text.danger "Deprecated:" "DEPRECATED:"))
37 changes: 37 additions & 0 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading