vim-denops / denops.vim

🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno
https://vim-denops.github.io/denops-documentation/
MIT License
666 stars 33 forks source link

Invalid plugin name (control char/backslash) breaks denops.vim #390

Closed Milly closed 1 month ago

Milly commented 1 month ago

Describe the bug

If you specify a plugin name that contains control characters or backslashes to denops#plugin#load(), an error will occur or it will not work correctly.

Provide a minimal vimrc with less than 50 lines to reproduce

set rtp+=/path/to/github.com/vim-denops/denops.vim
let g:denops#debug = 1
autocmd User DenopsReady call denops#plugin#load("foo\nbar", '/path/to/plugin.ts')

plugin.ts

const main = () => {
  console.log("Hello");
};

How to reproduce the problem from Vim startup

  1. Place denops.vim, vimrc and plugin.ts to correct path.
  2. Run vim -Nu vimrc.

Expected behavior

If an invalid name is specified, a proper error should be thrown.

Actual behavior

:message

[denops] load plugin: ['foo
[denops] bar', '/path/to/plugin.ts']
[denops] DenopsPluginPre:foo
[denops] DenopsPluginPost:foo
[denops] Failed to emit DenopsSystemPluginPre:foo
[denops] bar: Error: Failed to call 'denops#api#cmd' in Vim: Vim:E492: Not an editor command: bar
[denops] function denops#api#vim#call[2]..denops#api#cmd, line 2
[denops] Failed to emit DenopsSystemPluginPost:foo
[denops] bar: Error: Failed to call 'denops#api#cmd' in Vim: Vim:E492: Not an editor command: bar
[denops] function denops#api#vim#call[2]..denops#api#cmd, line 2

Your environment