Commit Graph

47 Commits

Author SHA1 Message Date
dundargoc
eb5d15e383 refactor: rewrite python provider in lua 2024-01-22 22:36:40 +01:00
Koichi Shiraishi
63528f4686
runtime: support once on s:GetAutocmdPrefix (#16457)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2021-12-10 12:28:55 -07:00
Björn Linse
396280d303 refactor(runtime): always use DIP_START when searching for runtime files
Now remove the addition of "start/*" packages in 'packpath' as
explicit items in 'runtimepath'. This avoids 'runtimepath' from becoming
very long when using a lot of plugins as packages.

To get the effective search path as a list, use |nvim_list_runtime_paths()|
2021-09-18 13:53:50 +02:00
kuuote
7124c0e5ac runtime: fix remote plugin command fails at some case
fixes #12410
2020-05-31 20:21:58 +09:00
Jacques Germishuys
c25b5a1576
remote plugins: add support for perl hosts 2020-01-20 19:43:59 -05:00
Justin M. Keyes
58dd5fcc01
jobstop(): close channel before process_stop() #10522
fix #9799
regression of #7081
Helped-by: Björn Linse <bjorn.linse@gmail.com>

Problem: :UpdateRemotePlugins (which calls rpcstop()) sometimes crashes:

    remote/host: python3 host registered plugins []
    nvim: ../src/nvim/event/wstream.c:78:
      _Bool wstream_write(Stream *, WBuffer *): Assertion `!stream->closed' failed.
    Aborted (core dumped)

  Order of events (channel 163, see logs below):

    1. Channel's in-stream (0x2ba86c0) is **closed** by `f_rpcstop`..`process_stop`.
    2. `receive_msgpack` parses the channel out-stream (0x2ba8860)
    3. Invokes "nvim_command_output" API method.
    4. Writes result to the **closed** in-stream  => **abort**

  - af993da435 (`receive_msgpack`) tried to hack around same/similar issue.
  - Hack was removed in 5215e3205a.

Solution: in jobstop(), close the channel before process_stop().

Log:

    DEBUG 2019-07-16T20:54:12.191 25159 stream_close:96: closing Stream: 0x2b01a90
    DEBUG 2019-07-16T20:54:12.210 25159 process_spawn:124: new: pid=28407 argv=[/usr/bin/python3]
    DEBUG 2019-07-16T20:54:12.210 25159 rpc_start:72: rpc ch 163 in-stream=0x2ba86c0 out-stream=0x2ba8860
    INFO  2019-07-16T20:54:12.210 25159 channel_create_event:199: new channel 163 (function <SNR>61_on_exit[4]..<SNR>60_job_exit_cb[101]..<SNR>60_decrement_job_count[8]..remote#host#UpdateRemotePlugins[6]..<SNR>31_RegistrationCommands[15]..remote#host#Require[10]..provider#pythonx#Require[13]..provider#Poll:3) : {"id": 163, "client": {}, "mode": "rpc", "stream": "job"}
    DEBUG 2019-07-16T20:54:12.211 25159 log_server_msg:729: RPC ->ch 163: [request]  [0, 1, "poll", []]
    DEBUG 2019-07-16T20:54:12.355 25159 receive_msgpack:227: ch 163: parsing 21 bytes from msgpack Stream: 0x2ba8860
    DEBUG 2019-07-16T20:54:12.355 25159 log_client_msg:766: RPC <-ch 163: [request]  [0, 1, "vim_get_api_info", []]
    DEBUG 2019-07-16T20:54:12.355 25159 RPC: <-ch 163: invoke nvim_get_api_info
    DEBUG 2019-07-16T20:54:12.357 25159 log_server_msg:729: RPC ->ch 163: [response] [1, 1, nil, [163, {"version"=>{"major"=>0, "minor"=>4, }, ...
    DEBUG 2019-07-16T20:54:12.377 25159 receive_msgpack:227: ch 163: parsing 85 bytes from msgpack Stream: 0x2ba8860
    DEBUG 2019-07-16T20:54:12.377 25159 log_client_msg:766: RPC <-ch 163: [request]  [0, 2, "nvim_eval", ["((&number||&relativenumber) ? &numberwidth : 0) + &foldcolumn"]]
    DEBUG 2019-07-16T20:54:12.377 25159 handle_request:359: RPC: scheduled nvim_eval
    DEBUG 2019-07-16T20:54:12.377 25159 log_client_msg:766: RPC <-ch 163: [response] [1, 1, nil, "ok"]
    DEBUG 2019-07-16T20:54:12.378 25159 log_server_msg:729: RPC ->ch 163: [request]  [0, 2, "specs", ["/home/vagrant/.config/nvim/rplugin/python3/__pycache__"]]
    DEBUG 2019-07-16T20:54:12.378 25159 RPC: <-ch 163: invoke nvim_eval
    DEBUG 2019-07-16T20:54:12.379 25159 log_server_msg:729: RPC ->ch 163: [response] [1, 2, nil, 0]
    DEBUG 2019-07-16T20:54:12.379 25159 receive_msgpack:227: ch 163: parsing 5 bytes from msgpack Stream: 0x2ba8860
    DEBUG 2019-07-16T20:54:12.379 25159 log_client_msg:766: RPC <-ch 163: [response] [1, 2, nil, 0]
    DEBUG 2019-07-16T20:54:12.380 25159 log_server_msg:729: RPC ->ch 163: [request]  [0, 3, "specs", ["/home/vagrant/.config/nvim/rplugin/python3/foo.py"]]
    DEBUG 2019-07-16T20:54:12.380 25159 receive_msgpack:227: ch 163: parsing 79 bytes from msgpack Stream: 0x2ba8860
    DEBUG 2019-07-16T20:54:12.380 25159 log_client_msg:766: RPC <-ch 163: [request]  [0, 3, "nvim_command", ["redir =>a |exe "sil sign place buffer=".bufnr('')|redir end"]]
    DEBUG 2019-07-16T20:54:12.381 25159 handle_request:359: RPC: scheduled nvim_command
    DEBUG 2019-07-16T20:54:12.381 25159 RPC: <-ch 163: invoke nvim_command
    DEBUG 2019-07-16T20:54:12.381 25159 log_server_msg:729: RPC ->ch 163: [response] [1, 3, nil, nil]
    DEBUG 2019-07-16T20:54:12.381 25159 receive_msgpack:227: ch 163: parsing 5 bytes from msgpack Stream: 0x2ba8860
    DEBUG 2019-07-16T20:54:12.381 25159 log_client_msg:766: RPC <-ch 163: [response] [1, 3, nil, 0]
    DEBUG 2019-07-16T20:54:12.382 25159 stream_close:95: trace:
      log_callstack at /home/vagrant/neovim/build/../src/nvim/log.c:256
      stream_close at /home/vagrant/neovim/build/../src/nvim/event/stream.c:95
      stream_may_close at /home/vagrant/neovim/build/../src/nvim/event/stream.c:111
      process_stop at /home/vagrant/neovim/build/../src/nvim/event/process.c:230
      f_jobstop at /home/vagrant/neovim/build/../src/nvim/eval.c:12231
      f_rpcstop at /home/vagrant/neovim/build/../src/nvim/eval.c:14533
      call_func at /home/vagrant/neovim/build/../src/nvim/eval.c:6564
      get_func_tv at /home/vagrant/neovim/build/../src/nvim/eval.c:6304
      ex_call at /home/vagrant/neovim/build/../src/nvim/eval.c:2903
      do_one_cmd at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:2249
      do_cmdline at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:593
      call_user_func at /home/vagrant/neovim/build/../src/nvim/eval.c:22666
      call_func at /home/vagrant/neovim/build/../src/nvim/eval.c:6550
      get_func_tv at /home/vagrant/neovim/build/../src/nvim/eval.c:6304
      eval7 at /home/vagrant/neovim/build/../src/nvim/eval.c:4407
      eval6 at /home/vagrant/neovim/build/../src/nvim/eval.c:4104
      eval5 at /home/vagrant/neovim/build/../src/nvim/eval.c:3985
      eval4 at /home/vagrant/neovim/build/../src/nvim/eval.c:3688
      eval3 at /home/vagrant/neovim/build/../src/nvim/eval.c:3606
      eval2 at /home/vagrant/neovim/build/../src/nvim/eval.c:3537
      eval1 at /home/vagrant/neovim/build/../src/nvim/eval.c:3464
      eval0 at /home/vagrant/neovim/build/../src/nvim/eval.c:3424
      ex_let_const at /home/vagrant/neovim/build/../src/nvim/eval.c:1604
      ex_let at /home/vagrant/neovim/build/../src/nvim/eval.c:1546
      do_one_cmd at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:2249
      do_cmdline at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:593
      call_user_func at /home/vagrant/neovim/build/../src/nvim/eval.c:22666
      call_func at /home/vagrant/neovim/build/../src/nvim/eval.c:6550
      get_func_tv at /home/vagrant/neovim/build/../src/nvim/eval.c:6304
      ex_call at /home/vagrant/neovim/build/../src/nvim/eval.c:2903
      do_one_cmd at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:2249
      do_cmdline at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:593
      do_ucmd at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:5803
      do_one_cmd at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:2243
      do_cmdline at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:593
      call_user_func at /home/vagrant/neovim/build/../src/nvim/eval.c:22666
      call_func at /home/vagrant/neovim/build/../src/nvim/eval.c:6550
      get_func_tv at /home/vagrant/neovim/build/../src/nvim/eval.c:6304
      ex_call at /home/vagrant/neovim/build/../src/nvim/eval.c:2903
      do_one_cmd at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:2249
      do_cmdline at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:593
      call_user_func at /home/vagrant/neovim/build/../src/nvim/eval.c:22666
      call_func at /home/vagrant/neovim/build/../src/nvim/eval.c:6550
      get_func_tv at /home/vagrant/neovim/build/../src/nvim/eval.c:6304
      ex_call at /home/vagrant/neovim/build/../src/nvim/eval.c:2903
      do_one_cmd at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:2249
      do_cmdline at /home/vagrant/neovim/build/../src/nvim/ex_docmd.c:593
      call_user_func at /home/vagrant/neovim/build/../src/nvim/eval.c:22666
      call_func at /home/vagrant/neovim/build/../src/nvim/eval.c:6550
      callback_call at /home/vagrant/neovim/build/../src/nvim/eval.c:17917
      channel_callback_call at /home/vagrant/neovim/build/../src/nvim/channel.c:675
      on_channel_event at /home/vagrant/neovim/build/../src/nvim/channel.c:581
      multiqueue_process_events at /home/vagrant/neovim/build/../src/nvim/event/multiqueue.c:147
      nv_event at /home/vagrant/neovim/build/../src/nvim/normal.c:7987
      normal_execute at /home/vagrant/neovim/build/../src/nvim/normal.c:1133
      state_enter at /home/vagrant/neovim/build/../src/nvim/state.c:73
      normal_enter at /home/vagrant/neovim/build/../src/nvim/normal.c:462
      main at /home/vagrant/neovim/build/../src/nvim/main.c:570
      ?? ??:0
      _start at ??:?
    DEBUG 2019-07-16T20:54:12.417 25159 stream_close:96: closing Stream: 0x2ba86c0
    INFO  2019-07-16T20:54:12.417 25159 os_proc_tree_kill:96: sending SIGTERM to process group: -28407
    DEBUG 2019-07-16T20:54:12.417 25159 receive_msgpack:227: ch 163: parsing 31 bytes from msgpack Stream: 0x2ba8860
    DEBUG 2019-07-16T20:54:12.417 25159 log_client_msg:766: RPC <-ch 163: [request]  [0, 4, "nvim_command_output", ["echo a"]]
    DEBUG 2019-07-16T20:54:12.417 25159 handle_request:359: RPC: scheduled nvim_command_output
    DEBUG 2019-07-16T20:54:12.424 25159 RPC: <-ch 163: invoke nvim_command_output
    DEBUG 2019-07-16T20:54:12.424 25159 log_server_msg:729: RPC ->ch 163: [response] [1, 4, [0, "Vim(echo):E121: Undefined variable: a"], nil]
    ERROR 2019-07-16T20:54:12.424 25159 wstream_write:78: xxx stream=0x2ba86c0
    DEBUG 2019-07-16T20:54:12.425 25159 wstream_write:79: trace:
      log_callstack at /home/vagrant/neovim/build/../src/nvim/log.c:256
      wstream_write at /home/vagrant/neovim/build/../src/nvim/event/wstream.c:82
      channel_write at /home/vagrant/neovim/build/../src/nvim/msgpack_rpc/channel.c:407
      request_event at /home/vagrant/neovim/build/../src/nvim/msgpack_rpc/channel.c:383
      multiqueue_process_events at /home/vagrant/neovim/build/../src/nvim/event/multiqueue.c:147
      nv_event at /home/vagrant/neovim/build/../src/nvim/normal.c:7987
      normal_execute at /home/vagrant/neovim/build/../src/nvim/normal.c:1133
      state_enter at /home/vagrant/neovim/build/../src/nvim/state.c:73
      normal_enter at /home/vagrant/neovim/build/../src/nvim/normal.c:462
      main at /home/vagrant/neovim/build/../src/nvim/main.c:570
      ?? ??:0
      _start at ??:?
2019-07-17 11:13:57 +02:00
Justin M. Keyes
c0157e8fe0
remote/host.vim: specify {nosuf} for globpath() (#8882) 2018-08-24 10:17:59 +02:00
Billy Vong
7890157931 remote: add node.js as a remote plugin provider 2017-10-29 11:10:33 -07:00
Björn Linse
2a3bcd1ff8 rpc: Don't delay notifications when request is pending (#6544)
With the old behavior, if a GUI makes a blocking request that requires user
interaction (like nvim_input()), it would not get any screen updates.

The client, not nvim, should decide how to handle notifications during a
pending request. If an rplugin wants to avoid async calls while a sync call is
busy, it likely wants to avoid processing async calls while another async call
also is handled as well.

This may break the expectation of some existing rplugins. For compatibility,
remote/define.vim reimplements the old behavior. Clients can opt-out by
specifying `sync=urgent`.

- Legacy hosts should be updated to use `sync=urgent`. They could add a flag
  indicating which async methods are always safe to call and which must wait
  until the main loop returns.
- New hosts can expose the full asyncness, they don't need to offer both
  behaviors.

ref #6532
ref #1398 d83868fe90
2017-10-29 03:06:53 +01:00
Andy Russell
460aab3950 escape amatch filename (#7292)
Fixes #7046
Fixes autozimu/LanguageClient-neovim#77
2017-09-19 08:13:44 +02:00
Justin M. Keyes
d1afd434f3 rplugin: Call s:LoadRemotePlugins() on startup.
Dispense with the FuncUndefined/CmdUndefined quasi-optimization.
If there are no rplugins, plugin/rplugin.vim takes less than 1ms.

Closes #5821
Closes #6250

Helped-by: Qiming zhao <chemzqm@gmail.com>
2017-03-11 12:26:22 +01:00
Marco Hinz
657ba62a84 rplugin: resolve paths in manifest file (#5501)
`:CheckHealth nvim` would always report an outdated manifest if symlinks were
used, because the manifest file contains unresolved paths that get compared
against resolved paths.

Now we resolve paths before they get written to the manifest file.
2016-10-18 23:16:13 +02:00
Shougo
1dde512498 UpdateRemotePlugins: Discard duplicate paths. (#5464) 2016-10-12 01:04:59 +02:00
Justin M. Keyes
d57f25e5ef doc/vim_diff.txt (#5432) 2016-10-06 09:45:24 +02:00
Justin M. Keyes
297677ecf4 remote/host.vim: Avoid "No matching autocommands".
:silent does not silence this message, even :redir does not consume it.
But execute() _does_ consume it, which interferes with the current
implementation of health.vim. It's prudent to avoid it in any case, even
if the implementation of health.vim changes in the future.
2016-08-21 22:03:28 -04:00
Björn Linse
2d60a15e25 job control: reuse common job code for rpc jobs
This makes stderr and exit callbacks work for rpc jobs
2016-08-20 12:55:35 +02:00
Justin M. Keyes
f9aa029a8b host.vim: s:GetManifestPath(): octal permissions 2016-08-17 18:30:09 -04:00
Justin M. Keyes
acaf480bdc host.vim: s:GetManifestPath(): Create base directory if needed.
If the base directory does not exist, let mkdir(...,'p') create it.
2016-08-17 18:29:45 -04:00
Justin M. Keyes
4b0b391f9f host.vim: s:GetManifestPath(): Remove for-loop.
Without the for-loop it is easier to follow, more explicit, and fewer
lines.
2016-08-17 17:43:26 -04:00
Tommy Allen
01e33e1c74 runtime: rplugin manifest written to $XDG_DATA_HOME
Uses $NVIM_RPLUGIN_MANIFEST if available
2016-08-17 16:22:15 -04:00
Justin M. Keyes
aa2c439940 eval.c: rename capture() to execute() (#5132) 2016-07-31 13:23:29 -04:00
Shougo
0d5edcef4a rplugin: Manifest file name fallback (#4935) 2016-06-30 20:50:07 -04:00
Justin M. Keyes
46a080015f host.vim: s:RegistrationCommands(): Normalize slashes.
Closes #4795
2016-05-22 11:34:24 -04:00
Case Nelson
4a200ceafa test: remote/define.vim: range 2016-04-18 05:40:15 -04:00
Paul Jolly
d835c030f2 remote/define.vim: support remote function "range" 2016-04-18 05:24:46 -04:00
Shougo Matsushita
2ebc58d25a Fix loading remote plugin error 2016-04-19 06:52:04 +09:00
Dan Elkouby
e5147ce6a0 rplugin: Ignore modeline while chaining events 2016-04-18 09:21:22 +03:00
Aleksei Khudiakov
6e8757255e rplugin: Fix wrong condition for lazy loading remote plugins 2016-03-31 08:58:22 +10:00
Justin M. Keyes
66a75fb835 Merge pull request #4410 from alexgenco/ruby_rplugin
Ruby remote plugin support
2016-03-11 12:33:41 -05:00
Björn Linse
6c4d3362c5 rplugin: let the python host identify packages 2016-03-11 11:31:09 +01:00
Justin M. Keyes
1c066e671d rplugin: Silence :doautocmd. #4384 2016-03-11 01:22:41 -05:00
Alex Genco
3cb9970acf Ruby remote plugin support 2016-03-10 19:01:44 -08:00
Shougo Matsushita
bb020df0f5 rplugin: Initialize remote plugins lazily. #4384 2016-03-10 10:34:57 -05:00
Shougo Matsushita
41794f6b58 Improve remote plugin scripts 2016-02-14 08:24:49 +09:00
Shougo Matsushita
f338fee482 Fix UpdateRemotePlugins fails problem 2015-12-10 00:09:55 +09:00
Jonathan Skeate
5613b62224 host.vim: expand $MYVIMRC. #3342
According to the vim helpfile:

> fnamemodify({fname}, {mods})
>    ...
>    Note: Environment variables don't work in {fname}, use
>    expand() first then.

So this causes issues if your $MYVIMRC contains environment variables
(e.g. $XDG_CONFIG_HOME)
2015-09-14 21:59:13 -04:00
Jakob Schnitzer
c478dd5ab4 python: remove current working directory from path
Before, running Nvim in a directory containing a Python module `neovim`,
or one that is imported by it or a plugin, will load that module and not
the system one. So Nvim might be tricked into running arbitrary scripts
from the current working directory.

Fixes #1665
Fixes #2530
2015-09-14 12:06:49 +02:00
Björn Linse
73d9cd85df rplugin: Don't error if plugin is registered before host #2961
This makes it possible to register a lazy loaded host in a plugin/ file.
Previously this caused an error on restart after :UpdateRemotePlugins
2015-07-10 22:11:13 +02:00
Nick Hynes
0ffd51425e rplugin: pass additional info to host factory function #2920 2015-07-03 12:12:21 -04:00
Nick Hynes
105b8f1070 rplugin: allow users to register hosts #2896 2015-06-25 19:01:38 -04:00
Daniel Hahler
8d42db1eea remote#host#RequirePythonHost: fix reference to log
I could not find a reference to NVIM_PYTHON_PYTHON_LOG anywhere, and
python-client looks for NVIM_PYTHON_LOG_FILE.

~/.nvimlog appears to be hardcoded and enabled by default.  This would
need to be adjusted when this changes.
2015-06-09 10:29:46 +03:00
Shougo Matsushita
7dc241ac78 rplugin: Improve remote plugins detection messages #2769 2015-05-31 12:47:54 -04:00
Shougo Matsushita
42de617974 Add if_python3 support
Reviewed-by: Michael Reed <m.reed@mykolab.com>, Daniel Hahler <github@thequod.de>
Helped-by: Daniel Hahler <github@thequod.de>
2015-04-21 06:20:23 +09:00
Thiago de Arruda
54bd384338 runtime: Handle failures while loading individual remote plugins
The s:RegistrationCommands functions will now test the type of the "specs" rpc
call. If it's not a list, then the plugin failed to load and is skipped
2015-04-13 17:21:28 -03:00
Florian Walch
98c72305a9 Improve Python host messages. 2014-11-26 16:49:46 +01:00
Bjorn Tipling
fe27cbe1d8 Print an error and exit when there are no plugins.
Issue: #1537

Running the :UpdateRemotePlugins command will show an ugly, unhelpful
error when no plugins were found. This change has neovim print an error message
and does not attempt to start the python-client which requires at least one
plugin.
2014-11-24 13:53:21 -08:00
Thiago de Arruda
6b17082d3c runtime: Refer to plugins running outside Nvim as "remote plugins"
- Rename autoload/rpc to autoload/remote
- External plugins are now remote plugins
- External plugins directory is "rplugin"
2014-11-21 10:11:42 -03:00