clojure-vim / nvim-parinfer.js

neovim plugin for parinfer
https://shaunlebron.github.io/parinfer
108 stars 11 forks source link

Unknown function: ParinferIndent (only for .xtm file extension) #30

Open bryanmaina opened 7 years ago

bryanmaina commented 7 years ago

If I open a file with the following extension .xtm (which uses Lisp style expressions) and try to edit, I get this error in neovim:

Error detected while processing function <SNR>100_indent:                        
line    6:                                                                          
E117: Unknown function: ParinferIndent

This also happens only if I have 'timburgess/extempore.vim' installed. If I remove it there is no more problem. But I need extempore plugin to work with extempore.

I just added to my vimrc:

au BufNewFile,BufRead *.xtm let g:parinfer_mode = "off"

to avoid this error while waiting to know what's going wrong.

BerkeleyTrue commented 7 years ago

I'm also running into this error but in .cljs files as well.

snoe commented 7 years ago

For clojure @BerkeleyTrue, this is usually caused by not running :UpdateRemotePlugins it should give you feedback that it's registering nvim-parinfer.

@bryanmaina if I add the extempore.vim plugin and add a au BufNewFile,BufRead *.xtm set filetype=lisp line to my rc file, parinfer starts and runs without a problem. It sounds like it could be the same :UpdateRemotePlugins but unfortunately that's about as far as I can troubleshoot this without a repro.

BerkeleyTrue commented 7 years ago

@snoe Unfortunately that does not seems to change things. This is the output from UpdateRemotePlugins

function remote#host#UpdateRemotePlugins[6]..<SNR>47_RegistrationCommands[13]..remote#host#RegisterPlugin, line 5
Plugin "/Users/berkeley/.config/nvim/plugged/clj-refactor.nvim/rplugin/node/clj-refactor.js" is already registered
remote/host: python3 host registered plugins ['deoplete']
remote/host: generated rplugin manifest: /Users/berkeley/.local/share/nvim/rplugin.vim

Here is the list of my plugins, maybe there is something conflicting?

https://github.com/BerkeleyTrue/dotfiles/blob/master/dotfiles/modules/plugins.vim

BerkeleyTrue commented 7 years ago

This is what I've found messing around so far:

I also see this message Plugin "/Users/berkeley/.config/nvim/plugged/nvim-parinfer.js/rplugin/node/nvim-parinfer.js" is already registered

Looking into the manifest file after running UpdateRemotePlugin seems to have no calls to the nodehost

" python3 plugins
call remote#host#RegisterPlugin('python3', '/Users/berkeley/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete', [
      \ {'sync': v:true, 'name': '_deoplete', 'opts': {}, 'type': 'function'},
     \ ])

" ruby plugins

" python plugins

If I remove both nvim-parinfer and clj-refactor I get the following

" node plugins

" python3 plugins
call remote#host#RegisterPlugin('python3', '/Users/berkeley/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete', [
      \ {'sync': v:true, 'name': '_deoplete', 'opts': {}, 'type': 'function'},
     \ ])

" ruby plugins

" python plugins

Could it be the process that writes to this file is faulty?

snoe commented 7 years ago

@BerkeleyTrue Can you make sure that you have the latest node-host and that the versions being brought in are similar to mine? I'm also on neovim 0.1.7 but the api has been quite stable unlike node-host's

also I think npm install --production would be an improvement on your BuildNodeHost

 $ npm list
neovim-host@0.0.1 /Users/case/.vim/bundle/node-host
├── lodash.defaults@4.2.0
├── lodash.omit@4.5.0
└─┬ neovim-client@2.1.0
  ├── lodash@4.17.4
  ├─┬ msgpack5rpc@1.1.0
  │ └─┬ msgpack5@3.4.1
  │   ├── bl@1.2.0
  │   ├── inherits@2.0.3
  │   └─┬ readable-stream@2.2.2
  │     ├── buffer-shims@1.0.0
  │     ├── core-util-is@1.0.2
  │     ├── isarray@1.0.0
  │     ├── process-nextick-args@1.0.7
  │     ├── string_decoder@0.10.31
  │     └── util-deprecate@1.0.2
  └── traverse@0.6.6

~/.nvim/bundle/node-host on master
$ npm version
{ 'neovim-host': '0.0.1',
  npm: '3.10.7',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '57.1',
  modules: '48',
  node: '6.7.0',
  openssl: '1.0.2j',
  uv: '1.9.1',
  v8: '5.1.281.83',
  zlib: '1.2.8' }
BerkeleyTrue commented 7 years ago

Some interesting developments:

First my versions are similar to yours. My neovim was a single version behind your so I updated it. neovim-host@0.0.1 /Users/berkeley/.config/nvim/plugged/node-host ├── lodash.defaults@4.2.0 ├── lodash.omit@4.5.0 └── neovim-client@2.1.0

BerkeleyTrue:node-host berkeley$ npm version { 'neovim-host': '0.0.1', npm: '3.10.10', ares: '1.10.1-DEV', http_parser: '2.7.0', icu: '57.1', modules: '48', node: '6.9.1', openssl: '1.0.2j', uv: '1.9.1', v8: '5.1.281.84', zlib: '1.2.8' }

Still the same issue.

Then I tried cleaning and re-installing the three packages in different combinations. That raised the same issue. Then I threw in re-starting vim between installing packages.

I removed all three packages, installed node-host, updated remote plugins, Installed nvim-parinfer, restarted neovim, and updated remote plugins. This showed the correct message and indeed parinfer was listed in rplugins.vim.

But then installing clj-refactor causes the following

function remote#host#UpdateRemotePlugins[6]..<SNR>47_RegistrationCommands, line 20
Vim(let):Channel was closed by the client

then removing clj-refactor gives me the same error as before.

I can can't nvim-parinfer working but I cannot get it working with clj-refactor.

Is it possible that node-host is caching somewhere within it's directories?

edit: Looks like if I completely remove node-hosts but leave nvim-parinfer in I still get the already registered but. Maybe this is an error with neovim itslelf?

snoe commented 7 years ago

There's definitely an order dependency between installing plugins and calling :UpdateRemotePlugins and restarting neovim.

I'm able to repro your parinfer + refactor error, but I'm also able to recover by removing the refactor plugin line from my rc file, restarting nvim, running :UpdateRemotePlugins, restarting again, and then loading a clj file. I can do the opposite too - run refactor by itself and then adding parinfer blows up.

Unfortunately as with most issues here, I suspect that the source of the problem is somewhere in the node-host dependency chain. I had hoped that https://github.com/neovim/node-host/issues/21 would fix the multiple plugin issue, but it seems there's either been a regression or that fixed already registered plugins and installing multiple is still a problem.

I noticed your npm list maybe got cut off - msgpack5rpc@1.1.0 is the transitive dependency that should have fixed the above issue. Make sure you do have that installed at least.

I think, though, that the path forward is to add host capabilities to https://github.com/clojure-vim/neovim-client and drop node-host all together.

BerkeleyTrue commented 6 years ago

I was never able to get parinfer and refactor to work nicely together so I abandoned it.

I'm not seeing this same issue with just nvim-parinfer on my new machine. I'll diagnose and post findings here.

edit:

Looks like it is registering correctly

" node plugins
call remote#host#RegisterPlugin('node', '/home/berkeleytrue/.config/nvim/plugged/nvim-parinfer.js/rplugin/node/nvim-parinfer.js', [
     \ ])

" python3 plugins

" ruby plugins

" python plugins

edit2: running lein npm install in plugin directory solved the issue.

I've changed my plug install to Plug 'clojure-vim/nvim-parinfer.js', { 'do': 'lein npm install' }