[Bug report] No coloration with markdown + Treesitter
Closed this issue · 5 comments
Describe the bug
When I open a markdown file, I see syntactic coloration only inside fenced code blocks.
Expected behavior
Title, links, etc. should have some color.
Screenshots
System
Vim or Neovim: Neovim
Vim or Neovim version: v0.9.5
Any other plugins you may consider relevant:
Minimal configuration file
colorscheme base16-solarized-dark
Additional context
I opened nvim-treesitter/nvim-treesitter#6104 yesterday, and was told "Make sure your colorscheme has adjusted to the breaking change in capture naming." I think they were referring to nvim-treesitter/nvim-treesitter#2293 (comment)
This commit message indeed explains a lot: nvim-treesitter/nvim-treesitter@1ae9b0e
Sorry for reporting this, after disabling this plugin / the colorscheme instruction I have the same issue, so it cannot be because of this plugin.
🤔 unless the base theme I'm using also should adapt, which is possible.
a-ha! After searching for "Treesitter" instead of "treesitter", I can find some treesitter-related code in this repository:
base16-vim/colors/base16-solarized-dark.vim
Lines 288 to 296 in 7e22024
* 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`)
Changes needed ☝️
EDIT: I did the changes manually, and I don't have more colors… not sure how to troubleshoot this 🤔
Another EDIT: I was editing a clone of the repository instead of the file I'm actually using, and now I have some colors for somethings, so I guess my change
call <sid>hi("@variable.member", s:gui08, "", s:cterm08, "", "", "")
call <sid>hi("@module", s:gui05, "", s:cterm05, "", "italic", "")
call <sid>hi("@markup.link", s:gui08, "", s:cterm08, "", "", "")
call <sid>hi("@markup.link.url", s:gui08, "", s:cterm08, "", "italic", "")
is the right direction, although it seems incomplete (titles are still not colored).
@greg0ire thanks for reporting. Yeah I can replicate the bug, I'll look into fixing this.
I created a PR here: #78 can you test it out locally to make sure it solves the issue you've found?
Just tried it, and congrats, it appears to work great! Thank you!