Skip to content

registerFunction with lower-case function name is difficult to debug (fails without explaining the capitalization issue). #461

Open
@dlants

Description

@dlants

I'm defining a function:

  plugin.registerFunction(
    "magenta_lsp_response",
    (result: unknown) => {
      context.logger.log(
        `magenta_lsp_response got callback ${JSON.stringify(result)}`,
      );
    },
    {},
  );

I am running :UpdateRemotePlugins, and seeing the function defined in the rplugin manifest:

" node plugins
call remote#host#RegisterPlugin('node', '/Users/denislantsman/src/magenta.nvim/rplugin/node/magenta', [
      \ {'sync': v:false, 'name': 'WinClosed', 'type': 'autocmd', 'opts': {'pattern': '*'}},
      \ {'sync': v:false, 'name': 'Magenta', 'type': 'command', 'opts': {'nargs': '1'}},
      \ {'sync': v:false, 'name': 'MagentaKey', 'type': 'command', 'opts': {'nargs': '1'}},
      \ {'sync': v:false, 'name': 'magenta_lsp_response', 'type': 'function', 'opts': {}},
     \ ])

However, when I try and use it from nvim, I get "unknown function":

:call magenta_lsp_response()
E117: Unknown function: magenta_lsp_response
:lua vim.fn.magenta_lsp_response()
E5108: Error executing lua Vim:E117: Unknown function: magenta_lsp_response
stack traceback:
        [C]: in function 'magenta_lsp_response'
        [string ":lua"]:1: in main chunk

Any help would be appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions