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

Recent update to nvim-treesitter breaks markdown highlights #201

Closed
anhnamtran opened this issue Jan 20, 2024 · 1 comment · Fixed by #203
Closed

Recent update to nvim-treesitter breaks markdown highlights #201

anhnamtran opened this issue Jan 20, 2024 · 1 comment · Fixed by #203

Comments

@anhnamtran
Copy link

anhnamtran commented Jan 20, 2024

There is a recent commit that has broken markdown highlighting (and likely others) due to nvim-treesitter deciding to change a lot of their queries to use standard tree-sitter queries.

The changes in question:

  • tree-sitter "standard capture names"
    (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):

    • @parameter -> @variable.parameter
    • @field -> @variable.member
    • @namespace -> @module
    • @float -> @number.float
    • @symbol -> @string.special.symbol
    • @string.regex -> @string.regexp
    • @text.* -> @markup.* (strong, italic, link, strikethrough; with exceptions; see below)
    • @text.title -> @markup.heading
    • @text.literal -> @markup.raw
    • @text.reference -> @markup.link
    • @text.uri -> @markup.link.url (in markup links)
    • @string.special -> @markup.link.label (non-url links)
    • @punctuation.special -> @markup.list (markdown lists only; move subitems from @text.todo)
  • Helix captures
    (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

    • @method -> @function.method
    • @method.call -> @function.method.call
    • @text.{todo,warning,note,danger} -> @comment.{error,warning,hint,info,todo}
    • @text.diff.{add,delete,} -> @diff.{plus,minus,delta}
    • @text.uri -> @string.special.url (outside markup)
    • @preproc -> @keyword.directive
    • @define -> @keyword.directive(.define?)
    • @storageclass -> @keyword.storage
    • @conditional -> @keyword.conditional
    • @debug -> @keyword.debug
    • @exception -> @keyword.exception
    • @include -> @keyword.import
    • @repeat -> @keyword.repeat

The breakage is due to onedark.nvim not having some of the captures defined.

Some screenshots of running TSHighlighCaptureUnderCursor on a header before and after the nvim-treesitter change
image

image

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 a pull request may close this issue.

2 participants