neovim / neovim/node-client

Cannot declare functions when there is "import" statement

Open
#484 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
537
Forks
57
Avg merge
1h 6m
Merged PRs (30d)
6

Description

This is my rplugin (actually I just copied from the prototype example)

function MyPlugin(plugin) {
  this.plugin = plugin;
  plugin.registerFunction('MyFunc', [this, MyPlugin.prototype.func]);
}

MyPlugin.prototype.func = function() {
  this.plugin.nvim.setLine('A line, for your troubles');
};

export default MyPlugin;

If I save it to ~/.config/nvim/rplugin/node/myplugin/index.js then run :UpdateRemotePlugins | !cat ~/.local/share/nvim/rplugin.vim, then the result show that the function MyFunc has been registered. But if I just add this line to the top of the file index.js

import { abort } from "process";

Running :UpdateRemotePlugins | !cat ~/.local/share/nvim/rplugin.vim again and it show that the function MyFunc is not registered

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rplugin file at ~/.config/nvim/rplugin/node/myplugin/index.js and compare the output of :UpdateRemotePlugins | !cat ~/.local/share/nvim/rplugin.vim with and without the import statement. Done means MyFunc remains registered after the import is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.