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

Treesitter highlights broken due to query: invalid node type #393

Closed
hhcwyx opened this issue Jan 1, 2023 · 2 comments
Closed

Treesitter highlights broken due to query: invalid node type #393

hhcwyx opened this issue Jan 1, 2023 · 2 comments
Labels
bug Something isn't working educational Issues that contain useful content env Issues caused by incorrect environment settings (terminal, package manager, etc.) treesitter Treesitter related issues

Comments

@hhcwyx
Copy link

hhcwyx commented Jan 1, 2023

Neovim version

NVIM0.8.2

Operating system/version

archlinux

Terminal name/version

alacritty

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

编写python文件时,总是出现一些信息,比如:
print('hello world') treesitter/highlighter:Error executing lua:/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:219 :querry: invalid node type at position 6469 for language python

Expected behavior

怎么把这些信息屏蔽掉呢?

Actual behavior

No response

Additional information

No response

@hhcwyx hhcwyx added the bug Something isn't working label Jan 1, 2023
@ayamir
Copy link
Owner

ayamir commented Jan 1, 2023

Perhaps it can be solved by reinstall python's parser.
:TSInstall python then type y and enter.

@ayamir ayamir changed the title 在编写python文件的时候,老是在行尾提示以下信息: python treesitter complain error Jan 1, 2023
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Jan 2, 2023

@hhcwyx If installing tree-sitter and then recompiling the parsers does not solve the problem, this happens because, after an update to nvim-treesitter or a related plugin, you have updated queries but not the corresponding parser (or vice versa), but queries are only compatible with specific parser versions, leading to errors if they no longer match. Try the following steps:

  1. Make sure that nvim-treesitter is updated to the latest commit and run :TSUpdate manually.
  2. If the error persists, remove nvim-treesitter completely and reinstall it together with all parsers.
  3. If the error still persists, run :checkhealth and note down the languages for which you see errors (an x in the list of languages, and explicitly listed below that). For each language <lang>, repeat the following steps:
  • :TSInstall! <lang> and restart nvim; if the error persists, continue.
  • Run the following commands and note down the output:
:echo nvim_get_runtime_file('*/<lang>.so', v:true)
:echo nvim_get_runtime_file('queries/<lang>/*.scm', v:true)
  • If either of these lists contain a directory that is not a subdirectory of nvim-treesitter, remove that directory (and, if it is another plugin, report the issue at the corresponding repository).

@Jint-lzxy Jint-lzxy added treesitter Treesitter related issues env Issues caused by incorrect environment settings (terminal, package manager, etc.) labels Jan 2, 2023
@Jint-lzxy Jint-lzxy changed the title python treesitter complain error Treesitter highlights broken due to query: invalid node type Jan 2, 2023
@Jint-lzxy Jint-lzxy pinned this issue Jan 2, 2023
@Jint-lzxy Jint-lzxy added the needs:response Waiting for reply from the author label Jan 4, 2023
@hhcwyx hhcwyx closed this as completed Jan 7, 2023
@Jint-lzxy Jint-lzxy removed the needs:response Waiting for reply from the author label Jan 7, 2023
@CharlesChiuGit CharlesChiuGit added the educational Issues that contain useful content label Feb 8, 2023
This was referenced Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working educational Issues that contain useful content env Issues caused by incorrect environment settings (terminal, package manager, etc.) treesitter Treesitter related issues
Projects
None yet
Development

No branches or pull requests

4 participants