dracula/vim

Treesitter Markdown highlighting

GNOMES opened this issue · 8 comments

GNOMES commented

I currently have Treesitter installed in Neovim, which suggests disabling Neovim's native highlighting for performance (additional_vim_regex_highlighting = false) vs duplicating highlights.

When using the Treesitter "Markdown" parser and Dracula.vim, all of the text is white, while tables are pink dash lines (note I have replaced the colors with Van Helsing Pro colors):

Screenshot 2024-02-02 at 23 13 14

It appears that Dracula.vim is not support Treesitter highlight groups for Markdown files.

Running "set syntax=markdown" to turn the native highlighting back on introduces coloring, but it is not very contextually aware beyond headings types and bulleted lists.

I ran across this thread that mentions that themes need to support the parser highlight groups, or it will not work:
https://www.reddit.com/r/neovim/comments/rg97j4/comment/hoiwnbj/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

As noted by one of the users, I installed Cattpucin to test this implementation, and it does appear to be improved for headings for example:

Screenshot 2024-02-02 at 23 10 57

Should this context aware highlighting already be working? Are there suggestions on how to implement this for a possible future PR or my own personal dotfiles?

I'm not sure why the treesitter version isn't working (though pro doesn't yet have many of the updates here), but the regular syntax looks correct. If you want different colors for the header levels, that's pretty easy to customize once you know the highlight groups (which you can find in the code or by using the syntax APIs).

stnley commented

Could you confirm which version of neovim you're on? I'm currently working on a patch to add new TS groups introduced in neovim master.

GNOMES commented
stnley commented

Looking at highlight_group.c in the neovim 0.9.5 release, I do not see any tree-sitter groups which are undefined (either by this theme directly, or by this theme modifying the default group linked by neovim).

This is what I see when using neovim 0.9.5, nvim-treesitter HEAD, and additional_vim_regex_highlighting = false.

dracula-master-without-regex

If you put your cursor on a markdown heading and run :TSHighlightCapturesUnderCursor what is the result?

This is mine:
1707087880_grimshot

Now, because nvim-treesitter and neovim have been changing their captures/groups my thought was to write a patch to add what is missing from nvim-treesitter to this theme. I wanna make sure I include anything you're missing too.

GNOMES commented

Hmm, I don't have :TSHighlightCapturesUnderCursor. Can you confirm the exact command you are running?

I see references to this command online in the now archived nvim-treesitter/playground, which says the functionality was merged into Nvim itself.

Trying the merged :Inspect command, I see the following on headings:

:Inspect
Treesitter
  - @markup.heading.2.marker.markdown links to @markup markdown

For a level 2 "##" headings.

@GNOMES would you mind updating this plugin and providing feedback? New treesitter groups were just merged.

Great, can we close this?