Coder Social home page Coder Social logo

Comments (14)

MichaelVessia avatar MichaelVessia commented on June 13, 2024 19

I have this issue as well. It's because you're in a .lua file but there's also .vim syntax present. If I remember correctly, I would :TSUpdate vim and it would resolve it.

from kickstart.nvim.

MitchRivet avatar MitchRivet commented on June 13, 2024 4

I noticed this too on a fresh install today, but :TSUpdate vim has fixed it for me

from kickstart.nvim.

sven-strothoff avatar sven-strothoff commented on June 13, 2024 4

Adding vim to the ensure_installed list for treesitter seems to resolve this problem as well (and persistently across restarts).
https://github.com/nvim-lua/kickstart.nvim/blob/master/init.lua#L221

Follow-up: The lua queries from nvim-treesitter contain injections referencing vim. I guess this is causing the problem. Although I am not sure if missing the referenced injections "should" crash the parser or if this is some other bug.
At least adding lua and not vim to treesitter (like the kickstart does), seems to be the cause for the errors.

from kickstart.nvim.

agentHoover avatar agentHoover commented on June 13, 2024

Thank you @MichaelVessia this solved it for me.
Next time I opened nvim the problem returned.

from kickstart.nvim.

kalleh avatar kalleh commented on June 13, 2024

:TSUpdate vim seems to have resolved it for me as well, but keeping the issue open as it seems common enough that it should probably be worked around in the bootstrap code.

from kickstart.nvim.

tjdevries avatar tjdevries commented on June 13, 2024

So just to make sure we're clear, after running :TSUpdate vim the problem was resolved?

from kickstart.nvim.

kalleh avatar kalleh commented on June 13, 2024

Correct.

from kickstart.nvim.

agentHoover avatar agentHoover commented on June 13, 2024

It did not fix it for me. But this predates my starting over with configuration using this repo.
here is the current output from checkhealth

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 v18.12.1 (only needed for :TSInstallFromGrammar)
  • OK: git executable found.
  • OK: cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  • 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.0.6-76060006-generic",
sysname = "Linux",
version = "#202210290932166906205022.04~d94609a SMP PREEMPT_DYNAMIC Mon N"
}

Parser/Features H L F I J

  • regex βœ“ . . . .
  • go βœ“ βœ“ βœ“ βœ“ βœ“
  • json βœ“ βœ“ βœ“ βœ“ .
  • vim x βœ“ βœ“ . βœ“
  • comment βœ“ . . . .
  • lua βœ“ βœ“ βœ“ βœ“ βœ“
  • html βœ“ βœ“ βœ“ βœ“ βœ“
  • bash βœ“ βœ“ βœ“ . βœ“
  • javascript βœ“ βœ“ βœ“ βœ“ βœ“
  • gitattributes βœ“ . . . βœ“
  • git_rebase βœ“ . . . βœ“
  • python βœ“ βœ“ βœ“ βœ“ βœ“
  • gitcommit βœ“ . . . βœ“
  • typescript βœ“ βœ“ βœ“ βœ“ βœ“
  • help βœ“ . . . βœ“
  • mermaid βœ“ . . . .
  • yaml βœ“ βœ“ βœ“ βœ“ βœ“
  • c_sharp βœ“ βœ“ βœ“ . βœ“
  • markdown βœ“ . βœ“ . βœ“
  • c βœ“ βœ“ βœ“ βœ“ βœ“
  • rust βœ“ βœ“ βœ“ βœ“ βœ“
  • cpp βœ“ βœ“ βœ“ βœ“ βœ“

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}

The following errors have been detected:

  • ERROR: vim(highlights): /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:171: query: invalid node type at position 4647 for language vim
    vim(highlights) is concatenated from the following files:
    | [OK]:"/home/moose/.local/share/nvim/site/pack/packer/start/nvim-treesitter/queries/vim/highlights.scm"
    | [ERROR]:"/usr/local/share/nvim/runtime/queries/vim/highlights.scm", failed to load: /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:171: query: invalid node type at position 581 for language vim

I was able to work around it using this syntax.
vim.cmd{ cmd='packadd packer.nvim'}

from kickstart.nvim.

MichaelVessia avatar MichaelVessia commented on June 13, 2024

@agentHoover I have this in my notes, if it's helpful:

-- If seeing errors parsing, check that you do not have two parsers installed.  Why this happens I do not know.
-- :echo nvim_get_runtime_file('*/python.so', v:true)
-- rm -rf /usr/local/lib/nvim/parser

I'm still learning about treesitter so I don't know why this happens, but it seems like two highlights.scm files sometimes exist, as it seems to be in your case, and then it doesn't know which to use.

from kickstart.nvim.

agentHoover avatar agentHoover commented on June 13, 2024

@MichaelVessia yep. That fixed it. I tried to uninstall the vim parser with TSUninstall vim and it told me that vim was still installed and exactly which file to remove manually to uninstall it. Removed the file, reinstalled, and all is well. The file I removed was located here: /usr/local/lib/nvim/parser/vim.so for what its worth.

Thanks for your help.

from kickstart.nvim.

fox1t avatar fox1t commented on June 13, 2024

I had the same issue and fixed adding 'vim' to ensure_installed.. Maybe we should add 'vim' to that array by default. Are there drawbacks to adding it?

from kickstart.nvim.

tjdevries avatar tjdevries commented on June 13, 2024

πŸ˜“ just that I thought I already had vim in the list haha

If someone wants a free PR, they can open. Otherwise I'll do probably tomorrow or soon

from kickstart.nvim.

mlabrkic avatar mlabrkic commented on June 13, 2024

I have investigated these two treesitter situations...

Situation 1

After installing vim parser no more treesitter (2) errors:
init.lua:
vim.cmd [[packadd packer.nvim]]
vim.cmd [[colorscheme onedark]]

Situation 2

Example 01 (commands-GOOD.lua):

vim.cmd( [[

" ------------------------ COMMANDS --------------------------

" ----------------------------------------------------------
" Comm_ 01:
" Edit init.vim and cd to folder:
command! QeditVIMRC :e $MYVIMRC | tcd %:h

" ----------------------------------------------------------
" Comm_ 02:
" Toggle line relativenumber on or off.
command! QnumberRelativ set relativenumber!

" ----------------------------------------------------------

]] )

Example 02 (commands-BAD.lua):
When you move the cursor slowly from the first row down, then you can see that the treesitter is not working well.

vim.cmd [[

" ------------------------ COMMANDS --------------------------

" ----------------------------------------------------------
" Comm_ 01:
" Edit init.vim and cd to folder:
command! QeditVIMRC :e $MYVIMRC | tcd %:h

" ----------------------------------------------------------
" Comm_ 02:
" Toggle line relativenumber on or off.
command! QnumberRelativ set relativenumber!

" ----------------------------------------------------------

]]

Desktop:

  • OS: Windows 10
  • Terminal: no, nvim-qt.exe

** Neovim Version **

  • Output of running :version from inside of neovim:

NVIM v0.8.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compiled by runneradmin@fv-az28-353

Features: -acl +iconv +tui
See ":help feature-compile"

system vimrc file: "$VIM\sysinit.vim"
fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"

from kickstart.nvim.

tjdevries avatar tjdevries commented on June 13, 2024

Should have all the required grammars now, so I can't reproduce crash anymore. Thanks!

from kickstart.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.