nvim-parinfer.js icon indicating copy to clipboard operation
nvim-parinfer.js copied to clipboard

Does not work with latest version of node-host

Open Kelvin-Chen opened this issue 7 years ago • 35 comments

When I run it with the latest version of node-host (v1.0.0) I get Unknown function: ParinferIndent. Downgrading back to v0.0.1 fixes the problem.

https://github.com/neovim/node-host/commit/0c116cb3b48af7debe8d6bbaa35dcab064d58fb9 mentions that breaking changes are incoming, so it looks like whatever changes they made broke this plugin.

Are there any plans to support the new node-host or should I just stay on v0.0.1 for now?

Kelvin-Chen avatar Aug 03 '17 05:08 Kelvin-Chen

I'm still debating between 1.0.0 and contributing to https://github.com/clojure-vim/neovim-client to allow hosting.

Is anyone using plugins that require node-host 1.0.0?

snoe avatar Aug 03 '17 14:08 snoe

v1.0.0 was only released 10 days ago, so there probably aren't any plugins that rely on it currently. I'm using quite a bit plugins and this is the only one I have that relies on node-host, so I can personally stay on v0.0.1 for as long as I want.

Kelvin-Chen avatar Aug 03 '17 14:08 Kelvin-Chen

I downgraded node-host but I'm not unable to get :UpdateRemotePlugins to work, @Kelvin-Chen did you run into the same issue per chance?

diffractometer avatar Aug 10 '17 00:08 diffractometer

@diffractometer I did not run into any issues with downgrading. Did you run npm install in the node-host directory?

Kelvin-Chen avatar Aug 10 '17 00:08 Kelvin-Chen

@Kelvin-Chen Thanks! That worked! Derp, I should have tried that. 🍻 <~ on me. Cheers.

diffractometer avatar Aug 10 '17 14:08 diffractometer

@snoe I'm not using any plugins which require node-host 1.0.0.

diffractometer avatar Aug 10 '17 14:08 diffractometer

I have this issue and honestly I think I've tried all combinations of all the random weird commands one should perform. I even tried downgrading node-host. All I get is just:

Error detected while processing function <SNR>17_indentparen:                                                                                                                                                        
line    8:                                                                                                                                                                                                           
E117: Unknown function: ParinferIndent                                                                                                                                                                               
E15: Invalid expression: ParinferIndent()                                                                                                                                                                            
line   10:                                                                                                                                                                                                           
E121: Undefined variable: lines                                                                                                                                                                                      
E116: Invalid arguments for function empty(lines) 

ashnur avatar Aug 19 '17 19:08 ashnur

I was able to undo the breaking changes, but with quite a bit of fiddling. I'm using vim-plugged to install my dependencies, which only seemed to download the latest HEAD. So when I define my plugins like:

call plug#begin('~/.vim/plugged')
Plug 'neovim/node-host'
call plug#end()

I don't seem to get the full git repository; I run git log --pretty=oneline and only get the latest commit:

d6de4e79bed0c71e74380e7b11cafaa1a0e9c055 Merge pull request #31 from neovim/fix/health-check-requiring-yarn

So my first thought was to wipe away what vim-plugged downloaded, and clone manually:

$ cd ~/.vim/plugged/
$ rm -rf node-host
$ git clone https://github.com/neovim/node-host

Next I checked out the reference to the non-breaking build, and installed its dependencies:

$ cd node-host
$ git checkout 0c116cb3b48af7debe8d6bbaa35dcab064d58fb9 .
$ npm install

This only fixed part of the problem, though. It seems there's a global dependency on node-host that must be resolved as well. I'm unsure why, but doing npm install -g [email protected] fails as the module cannot be found.

So I took a shot in the dark and moved the node-host module from ~/.vim/plugged/ to /usr/local/lib/node_modules/:

$ rm -rf /usr/local/lib/node_modules/node-host
$ cp -R ~/.vim/plugged/node-host /usr/local/lib/node_modules/

Afterwards opening vim and running :UpdateRemotePlugins seems to have restored parinfer back to a stable condition! I can't guarantee this works on other workstations, but I thought I'd share in case someone ends up here from Google.

lambdahands avatar Aug 28 '17 16:08 lambdahands

All you need to do is cd to plugged/node-host, git checkout v0.0.1, npm install, restart vim and run :UpdateRemotePlugins.

oemmerson avatar Sep 05 '17 14:09 oemmerson

@snoe This is the only plugin I'm using with node-host.

AlexChalk avatar Nov 06 '17 15:11 AlexChalk

Is anyone using plugins that require node-host 1.0.0?

not even node-host

ashnur avatar Nov 07 '17 08:11 ashnur

@snoe Since this is a plugin not only for Clojure development, and node-host has been merged into neovim, I think it's better to support node-host than clojure-vim/neovim-client.

markx avatar Nov 13 '17 21:11 markx

@markx Unfortunately, it looks like we're still stuck with node-client and it's dependency tree. You're right though, and I think it's a good time to bring this plugin back inline with everything.

snoe avatar Nov 15 '17 05:11 snoe

Ok I think I've got things updated to run with the HEAD version of neovim. I removed node-host from my plugins dir I brew install --head neovim I updated this plugin I updated node to 8.9.1 I ran brew install -g neovim Reran :UpdateRemotePlugins and restarted neovim Parinfer seemed to be working.

I'd like at least one person to confirm things look ok for them before closing this off.

Thanks for your patience.

snoe avatar Nov 15 '17 08:11 snoe

It doesn't work for me, yet.

  • Updated neovim to NVIM v0.2.2-38-gf8d40e7d5
  • removed node-host directiory
  • updated node to 8,9.1
  • npm install -g neovim
  • :UpdateRemotePlugins

Neovim doesn't have the Node provider available, I made created an issue in neovim

duikboot avatar Nov 15 '17 21:11 duikboot

I created an issue with neovim, but there seems to be a bug in CheckHealth

If I run: :PlugInstall

remote/host: python3 host registered plugins ['denite', 'deoplete']                                                                                                                                                                           
remote/host: generated rplugin manifest: /home/arjen/.local/share/nvim/rplugin.vim                                                                                                                                                            
function remote#host#UpdateRemotePlugins[6]..<SNR>18_RegistrationCommands[13]..remote#host#RegisterPlugin, line 5                                                                                                                             
Plugin "/home/arjen/config/dotfiles/_neovim/bundle/nvim-parinfer.js/rplugin/node/nvim-parinfer.js" is already registered                                                                                                                      
remote/host: python3 host registered plugins ['denite', 'deoplete']                                                                                                                                                                           
remote/host: generated rplugin manifest: /home/arjen/.local/share/nvim/rplugin.vim 

It looks like nvim-parinfer is installed.

If i open a lisp file and go into insert mode I get:

Error detected while processing function <SNR>49_process:                                                                                                                                                                                     
line    7:                                                                                                                                                                                                                                    
E117: Unknown function: ParinferProcessEvent                                                                                                                                                                                                  
Error detected while processing function <SNR>49_process:                                                                                                                                                                                     
line    7:                                                                                                                                                                                                                                    
E15: Invalid expression: ParinferProcessEvent(l:event)                                                                                                                                                                                        
Error detected while processing function <SNR>49_process:                                                                                                                                                                                     
line    8:                                                                                                                                                                                                                                    
E121: Undefined variable: l:result                                                                                                                                                                                                            
Error detected while processing function <SNR>49_process:                                                                                                                                                                                     
line    8:                                                                                                                                                                                                                                    
E116: Invalid arguments for function empty                                                                                                                                                                                                    
Error detected while processing function <SNR>49_process:                                                                                                                                                                                     
line    8:                                                                                                                                                                                                                                    
E15: Invalid expression: !empty(l:result) 

duikboot avatar Nov 15 '17 22:11 duikboot

@duikboot try to npm install -g yarn the neovim node host comments suggest that was an oversight left in checkhealth

snoe avatar Nov 15 '17 23:11 snoe

After updating everything, I also see these errors:

line    7:
E117: Unknown function: ParinferProcessEvent
E15: Invalid expression: ParinferProcessEvent(l:event)
line    8:
E121: Undefined variable: l:result
E116: Invalid arguments for function empty
E15: Invalid expression: !empty(l:result)

markx avatar Nov 16 '17 01:11 markx

~~I was able to install the plugin using nvim v0.2.2 via homebrew HEAD. If it installs successfully you should see:~~

remote/host: node host registered plugins ['nvim-parinfer.js', 'jest']

~~Try removing the plugin, :UpdateRemotePlugins, re-add to your vimrc and then run :PlugInstall and :UpdateRemotePlugins again.~~

I get errors in insert mode and it appears that plugin commands/functions aren't registering, will investigate.

Update: OK I see what the issue is, it depends on the neovim package. change rplugin/node/nvim-parinfer.js to a directory and add a package.json that has neovim as a dependency. We will probably want to move these plugin decorators into a new package, here is the tracking issue: https://github.com/neovim/node-client/issues/42

billyvg avatar Nov 16 '17 05:11 billyvg

Still doesn't work for me

It doesn't work yet on Fedora 26. CheckHealth still gives me:


## Node provider (optional)
  - WARNING: `node` and `npm` must be in $PATH.
    - ADVICE:
      - Install Node.js and verify that `node` and `npm` commands work.

which node and which npm give me the correct path.

$ vim --version
NVIM v0.2.2-38-gf8d40e7d5
Build type: RelWithDebInfo

duikboot avatar Nov 19 '17 20:11 duikboot

@billyvg thanks for helping with this.

What should cause the package.json dependencies to be pulled in? :UpdateRemotePlugins doesn't seem to npm install and, as a user, I think I would need the dependencies at that point.

If there was a single neovim-client file (or es6 module) I could bring it in in the same way as I bring in parinfer. Unfortunately the nested requires aren't supported by cljs https://clojurescript.org/reference/javascript-module-support#node.js-module.

In the meantime @duikboot I think you can run lein npm install in the root directory, and then NVIM_NODE_LOG_FILE=/tmp/nvim.log nvim and :UpdateRemotePlugins again. If that still fails, can you give the output of /tmp/nvim.log ?

snoe avatar Nov 20 '17 23:11 snoe

@billyvg I pushed a branch called package with your suggestion but I think it still requires the user to npm install in that rplugin/node/nvim-parinfer

snoe avatar Nov 20 '17 23:11 snoe

I had the same issue w.r.t Unknown function: ParinferProcessEvent errors and the like. I went to the root directory and executed lein npm install, and now it works.

I'm assuming that this is just a workaround?

cbcoutinho avatar Nov 26 '17 07:11 cbcoutinho

@snoe It works now, I also had to add the node-modules bin directory to my $PATH

Thanks a lot

duikboot avatar Nov 26 '17 11:11 duikboot

Is this issue still happening on neovim HEAD? https://github.com/neovim/neovim/blob/master/test/functional/provider/nodejs_spec.lua explicity sets NODE_PATH environment variable for require() to work on global modules.

janlazo avatar Dec 24 '17 23:12 janlazo

Ik works for me

duikboot avatar Dec 25 '17 07:12 duikboot

@cbcoutinho I also fixed by lein npm install, thanks.

diffractometer avatar Jan 03 '18 04:01 diffractometer

I get the same error as soon as a clj file is opened.

  • NVIM v0.2.3-413-g911b1e4 (Build type: Release)
  • Node 8.9.4
  • npm 5.6.0
  • Ubuntu

What is lein npm install supposed to do, 'npm' is not a task.?

krisleech avatar Jan 12 '18 16:01 krisleech

npm is the Node Package Manager, used mainly for javascript projects. Leiningen is a tool to build clojure projects [0], but is also able to import clojurescript/javascript functionality - hence the lein call to npm. The command lein npm install will run npm install through Leiningen.

I don't have enough knowledge about Clojure/Javascript/ClojureScript to expand further on why you need to do it this way.

[0] https://leiningen.org/

cbcoutinho avatar Jan 12 '18 16:01 cbcoutinho

I don't have any javascript in my project so do not use npm. Maybe you have a plugin in project.clj which adds the npm task...

krisleech avatar Jan 15 '18 09:01 krisleech