Skip to content

Cannot declare functions when there is "import" statement #484

Description

@brianhuster

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions