tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
427 stars 56 forks source link

markdown highlight error #131

Closed onns closed 10 months ago

onns commented 10 months ago

Describe the bug

markdown highlight disappear, same file, so I wanna know this happens to me only or somethings wrong with the plug.

Code example

Your example here
图片 图片

Expected behavior

Actual behavior

MDeiml commented 10 months ago

I'm not sure I understand the problem. It seems you have two different installations of neovim and they behave differently? Try updating the parsers for both, so run :TSUpdate for both installations.

kulla commented 10 months ago

markdown highlight disappear, same file, so I wanna know this happens to me only or somethings wrong with the plug.

Actually I encountered the same bug. I have the same nvim binary and :TSUpdate does not help (also uninstalling / reinstalling the parser does not help).

onns commented 10 months ago

I'm not sure I understand the problem. It seems you have two different installations of neovim and they behave differently? Try updating the parsers for both, so run :TSUpdate for both installations.

same neovim verison, different pc, one update and one not

onns commented 10 months ago
image

screenshot means that at commit [f9820b2db958228f9be339b67d2de874d065866e] the plugin works well, but error at commit [28aa3baef73bd458d053b613b8bd10fd102b4405].

so the changes between these two commits cause the bug I think.

dpopchev commented 10 months ago

I confirm lossing highlight after :TSUpdate and :TSUpdateSync.

I found that

# clean up and built in highlight 
:TSUninstall markdown
:TSUninstall markdown_inline
# highlight disappears 
:TSInstall markdown
# markdown_inline used to conceal the links nicely
# now there is no visible effect
:TSUninstall markdown
:TSInstall markdown_inline
# break the highlight again
:TSInstall markdown

I am using both markdown and markdown_highlight because only than I get nice collaring and inline conceiving. Now there is no difference with the built in highlight.

Let me know if you need more debug messages and such, honestly I do not have any idea what to retrieve.

Other parsers seem to work fine.

# checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v21.5.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 13.2.1 20230801
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.1.69-1-MANJARO",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Thu Dec 21 12:29:38 UTC 2023"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - diff                ✓ . . . .
  - json                ✓ ✓ ✓ ✓ .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - make                ✓ . ✓ . ✓
  - markdown_inline     ✓ . . . ✓
  - perl                ✓ . ✓ . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - vimdoc              ✓ . . . ✓
  - yaml                ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

:TSUpdate markdown_inline states all is up to date.

NOTE: I always wondered why there are two separated parsers.

PS: markdown breaks only highlight for language. The code blocks remain nicely highlighted as usual.

adrian5 commented 10 months ago

What you're seeing is likely due to recent changes in nvim-treesitter. For me it's already working again, but as the message says, pinning nvim-treesitter to an earlier version is a stop gap.

MDeiml commented 10 months ago

Another problem is queries that reference the anonymous node "[x]" specifically. This was changed in recent changes. The default queries from nvim-treestitter should work fine though.

clason commented 10 months ago

What you're seeing is likely due to recent changes in nvim-treesitter. For me it's already working again, but as the message says, pinning nvim-treesitter to an earlier version is a stop gap.

Yes, that. This is a (long announced and documented) breaking change in nvim-treesitter. It has nothing to do with the parser (this repo). Just update your colorscheme or pin nvim-treesitter to v0.9.2.

daviareias commented 10 months ago

Yes can confirm, you need to update your colorscheme or help your colorscheme maintainer to update it, I personally like melange and the maintainer opened an issue mentioning this: https://github.com/savq/melange-nvim/issues/74

kulla commented 10 months ago

Actually I encountered the same bug. I have the same nvim binary and :TSUpdate does not help (also uninstalling / reinstalling the parser does not help).

For me updating all plugins (:PlugUpdate since I use vim-plug) fixed the bug. Pinning nvim-treesitter was not necessary for me. (I use onedark as a color scheme)

yujinyuz commented 10 months ago

I don't get any error but highlighting seemed to be broken on my end as well. (I use kanagawa theme if that helps)

ayroblu commented 8 months ago

Random question, but why is only markdown broken with the treesitter upgrade? None of my other syntaxes have this issue with my colorscheme. Pinning to v0.9.2 fixes the issue I guess

MDeiml commented 8 months ago

Probably because markdown uses some captures that are unused in most normal programming languages, like headings.

clason commented 8 months ago

Yes. The biggest change in the upgrade applied to the markup-type captures which were completely renamed. Other changes were more moderate, and you probably just didn't notice them. (Nearly all languages were affected one way or another.)