nvim-treesitter-context icon indicating copy to clipboard operation
nvim-treesitter-context copied to clipboard

Latest neovim nightly fails to load treesitter-context

Open cwebster2 opened this issue 3 years ago • 12 comments

Loading the treesitter-context package in the latest nightly causes this error

image

Latest neovim 0.5

NVIM v0.5.0-dev+1152-gf5daf55c1
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az204-819```

cwebster2 avatar Mar 16 '21 03:03 cwebster2

Can't reproduce, can you give more details?

romgrk avatar Mar 16 '21 11:03 romgrk

https://github.com/romgrk/nvim-treesitter-context/blob/91869ed307084836e45abcf63a4fc0aee66a2d6e/lua/treesitter-context.lua#L369-L375 are the lines causing the error. I'm not reproing in a minimum config so this might be an interaction with something but I have not identified what, yet. I'm still investigating on my end for root cause.

cwebster2 avatar Mar 16 '21 17:03 cwebster2

Ok, maybe removing the silents there might give more details.

romgrk avatar Mar 16 '21 17:03 romgrk

Why is this closed? I have the same issue. Interestingly , if I open a file with nvim test.py it throws those errors, but if i open blank page with startify first, and then the file, it works just fine. Removing silent haven't produced more details.

vilari-mickopf avatar Mar 25 '21 10:03 vilari-mickopf

Additionally, it seems that function after autogroups M.update_context() is causing errors at the startup. If I comment this line, open a file and then execute :TSContextEnable, then no error is displayed, and context works just fine.

vilari-mickopf avatar Mar 25 '21 16:03 vilari-mickopf

i closed it myself as i havent been able to devote time to finding root cause. I am opining it back up.

cwebster2 avatar Mar 25 '21 16:03 cwebster2

Leave open if it's not solved, no need to close.

As for the issue, is it reproducible with no other plugins but TS and TS-context? If not, can you do a binary search to pinpoint the plugin that interacts badly with this one?

romgrk avatar Mar 25 '21 17:03 romgrk

Ok, so with all plugins disabled, it still throws all of those errors, but if I remove syntax on and syntax enable from the top of my init.vim, then it works again.

Also, I would like it more if plugin is disabled by default, and to open the context only when i really need it, so providing an option like context.vim:

let g:context_enabled = 0/1

seems like a natural thing to have.

vilari-mickopf avatar Mar 25 '21 18:03 vilari-mickopf

We should probably wait until everything is loaded before enabling the plugin, something like autocmd VimEnter * TSContextEnable, maybe nvim-treesitter isn't done loading yet.

romgrk avatar Mar 25 '21 19:03 romgrk

Is it reproducible for you now?

We should probably wait until everything is loaded before enabling the plugin, something like autocmd VimEnter * TSContextEnable, maybe nvim-treesitter isn't done loading yet.

This is fine with me. I've deleted syntax enable from top of my init.vim, because I don't really need it there, so I'm currently not experiencing this issue.

vilari-mickopf avatar Mar 26 '21 16:03 vilari-mickopf

Not reproducible with the latest build from master, on archlinux.

romgrk avatar Mar 26 '21 20:03 romgrk

I am using latest neovim-nightly-bin from aur.

Output of nvim --version:

NVIM v0.5.0-dev+1177-g095f5da79
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az49-10

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

And for me it is reproducable with this init.vim file

syntax enable

set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim

call dein#begin('~/.cache/dein')
call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')

call dein#add('nvim-treesitter/nvim-treesitter')
call dein#add('romgrk/nvim-treesitter-context')

call dein#end()
filetype plugin indent on
syntax enable

As I said, I've removed syntax enable from my init.vim, so this is not an issue for me any more, but still, I don't think that the plugin should behave like this in such case. Maybe @cwebster2 can check if syntax enable/on is causing problems for him as well.

vilari-mickopf avatar Mar 26 '21 22:03 vilari-mickopf

I have the same problem. syntax enable. When removed, it doesn't show the error.

tex avatar Oct 21 '22 19:10 tex

@tex Remove syntax enable from the beginning of the config and add it after treesitter is loaded (in my case that's after dein#end() line.

vilari-mickopf avatar Oct 22 '22 17:10 vilari-mickopf