tinted-theming / base16-vim

base16-vim refreshes and commits new themes weekly automatically and has a documented build process.
https://github.com/base16-project/base16
Other
103 stars 21 forks source link

[Bug report] No coloration with markdown + Treesitter #77

Closed greg0ire closed 5 months ago

greg0ire commented 7 months ago

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

2024-02-16_13-19

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 https://github.com/nvim-treesitter/nvim-treesitter/issues/6104 yesterday, and was told "Make sure your colorscheme has adjusted to the breaking change in capture naming." I think they were referring to https://github.com/nvim-treesitter/nvim-treesitter/issues/2293#issuecomment-1900679583

This commit message indeed explains a lot: https://github.com/nvim-treesitter/nvim-treesitter/commit/1ae9b0e4558fe7868f8cda2db65239cfb14836d0

greg0ire commented 7 months ago

Sorry for reporting this, after disabling this plugin / the colorscheme instruction I have the same issue, so it cannot be because of this plugin.

greg0ire commented 7 months ago

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

https://github.com/tinted-theming/base16-vim/blob/7e22024696caed16034c219a809fc8e32fce3301/colors/base16-solarized-dark.vim#L288-L296

* 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 :point_up:

EDIT: I did the changes manually, and I don't have more colors… not sure how to troubleshoot this :thinking:

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

JamyGolden commented 5 months ago

@greg0ire thanks for reporting. Yeah I can replicate the bug, I'll look into fixing this.

JamyGolden commented 5 months ago

I created a PR here: https://github.com/tinted-theming/base16-vim/pull/78 can you test it out locally to make sure it solves the issue you've found?

greg0ire commented 5 months ago

Just tried it, and congrats, it appears to work great! Thank you!