Stopped working on Neovim nightly
kristijanhusak opened this issue · 7 comments
Hi,
Recently I noticed that plugin stopped working for some reason on Neovim nightly. I'm not sure about the Vim or stable Neovim though. Here's the gif:
Also, I'm using nvim-treesitter and the highlights. Could that affect anything?
OS info:
Neovim version: NVIM v0.6.0-dev+331-gaba397991
OS: Manjaro Linux
Terminal: Kitty
I'm having trouble installing the nightly binary on arch linux, some compatibility issue. I tried compiling it from source, and the plugin seems to work with the latest master... but I'm guessing the problem really has to do with treesitter somehow.
One thing that the plugin does occasionally is it checks the syntax group under the cursor, but it only does that to decide what to skip. Still, I wonder if it's somehow related. For debugging purposes, could you try one callback that I think doesn't do anything with syntax groups at all, so we can check if it works or not? Try this example:
if (foo) {
bar
}
Put the cursor on the (foo)
and execute :call sj#js#JoinOneLineIf()
, and let me know if it does anything.
It works, it transforms it to this:
if (foo) bar
I checked the js.vim
file and tried few other things, like sj#js#SplitObjectLiteral()
and sj#js#SplitArgs()
in the respective context, and it works. Seems like command/mapping can't figure out the context, or what function to call.
Hm, that's surprising. The plugin executes all the callbacks for a certain filetype in order until one of them returns 1. Here's the entry point:
splitjoin.vim/plugin/splitjoin.vim
Lines 64 to 109 in fd0723b
Could you try to :echo b:splitjoin_split_callbacks
to see if that variable contains sj#js#SplitObjectLiteral
? Also try checking :echo sj#settings#Read('disabled_split_callbacks')
to see if for some reason some callbacks are not blocked. I don't see the connection to neovim, though, so I still don't have a good idea of what might be wrong. Maybe typescript filetype detection?
b:splitjoin_split_callbacks
is not defined at all. I checked before and after calling the command/mapping. sj#settings#Read('disabled_split_callbacks')
returns empty array.
Edit: I see that there are ftplugin for each filetype, and this doesn't get loaded at all. This is probably a Neovim issue. I'll investigate it further, thanks!
It's definitely a Neovim issue (linked).
Doing packadd splitjoin.vim
solves it.
Thanks for your help!
Ah, I see, the ftplugin/{filetype}/{plugin}.vim
files not getting loaded is something I've seen in one package manager as well. It's one of those things that works in Vim that is maybe lesser known, but I think it's a good way to organize them. Well, let's see if there's more issues, maybe I can add a note about workarounds in the documentation if this ends up being a long-term issue.
It's and issue only with package managers using builtin packages
feature. Plug should be working fine, since it appends plugins to rtp
manually.
I believe it will be fixed, since it affects a lot of plugins.