Skip to content

Node 12 support #141

@kalekseev

Description

@kalekseev

This is basically #122 but with reproduction steps.

Using one of the examples, but with console.log(Buffer) line in a command:

$ mkdir -p /tmp/test/rplugin/node/test

$ cat > /tmp/test/rplugin/node/test/index.js <<EOF
class MyPlugin {
  constructor(plugin) {
    this.plugin = plugin;

    plugin.registerCommand('SetMyLine', [this, this.setLine]);
  }

  setLine() {
    console.log(Buffer)
    this.plugin.nvim.setLine('A line, for your troubles');
  }
}

module.exports = (plugin) => new MyPlugin(plugin);

// Or for convenience, exporting the class itself is equivalent to the above

module.exports = MyPlugin;
EOF

On node 10 this works as expected and buffer updated with a line, on node 12 nothing happens and log contains:

Error in plugin for command:SetMyLine: Buffer is not defined (file: /tmp/test/rplugin/node/test, stack: ReferenceError: Buffer is not defined
  at MyPlugin.setLine (/tmp/test/rplugin/node/test/index.js:9:17)
  at Object.fn (/home/konstantin/.config/yarn/global/node_modules/neovim/lib/host/NvimPlugin.js:19:26)
  at NvimPlugin.<anonymous> (/home/konstantin/.config/yarn/global/node_modules/neovim/lib/host/NvimPlugin.js:156:41)
  at Generator.next (<anonymous>)
  at /home/konstantin/.config/yarn/global/node_modules/neovim/lib/host/NvimPlugin.js:8:71
  at new Promise (<anonymous>)
  at __awaiter (/home/konstantin/.config/yarn/global/node_modules/neovim/lib/host/NvimPlugin.js:4:12)
  at NvimPlugin.handleRequest (/home/konstantin/.config/yarn/global/node_modules/neovim/lib/host/NvimPlugin.js:134:16)
  at Host.<anonymous> (/home/konstantin/.config/yarn/global/node_modules/neovim/lib/host/index.js:71:27)
  at Generator.next (<anonymous>))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions