PerlNavigator: Crashes when used with neovim LSP
Thanks for your work on this project thus far. I’m trying to get it going in neovim and have reached the limits of my knowledge here, so maybe you can help me out.
I can’t quite work out what the issue is here, but it seems like it boils down to some method not being found in Perl Navigator? I’ve provided all of the info that seems relevant below. Let me know if there would be anything else that’s helpful.
I’m on Arch Linux with a 64-bit kernel version 5.15.23, with a perlbrew managed Perl v5.34.0.
When I open a Perl source file in neovim, a message appears at the bottom saying: Client 1 quit with exit code 1 and signal 0
In :LspInfo it says 0 clients are attached to this buffer. It recognizes the config for Perl Navigator, says it’s set to autostart and that it’s executable, and the command matches what I’ve configured in the neovim config.
neovim’s LSP debugging output:
[START][2022-02-17 10:17:27] LSP logging initiated
[INFO][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:261 "Starting RPC client" { args = { "/home/$USER/dev/PerlNavigator/server/out/server.js", "--stdio" }, cmd = "node", extra = { cwd = "/home/$USER/Sync/i7-dev/lutron" }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { id = 1, jsonrpc = "2.0", method = "initialize", params = { capabilities = { callHierarchy = { dynamicRegistration = false }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dataSupport = true, dynamicRegistration = false, resolveSupport = { properties = { "edit" } } }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false }, implementation = { linkSupport = true }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = false, prepareSupport = true }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = false }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, clientInfo = { name = "Neovim", version = "0.6.1" }, initializationOptions = vim.empty_dict(), processId = 176397, rootPath = "/home/$USER/Sync/i7-dev/lutron", rootUri = "file:///home/$USER/Sync/i7-dev/lutron", trace = "off", workspaceFolders = { { name = "/home/$USER/Sync/i7-dev/lutron", uri = "file:///home/$USER/Sync/i7-dev/lutron" } } }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 1, jsonrpc = "2.0", result = { capabilities = { completionProvider = { resolveProvider = false, triggerCharacters = { "$", "@", "%", "-", ">", ":" } }, definitionProvider = true, documentSymbolProvider = true, hoverProvider = true, textDocumentSync = 2, workspace = { workspaceFolders = { supported = true } }, workspaceSymbolProvider = true } }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { jsonrpc = "2.0", method = "initialized", params = vim.empty_dict()}
[DEBUG][2022-02-17 10:17:27] .../lua/vim/lsp.lua:921 "LSP[perlnavigator]" "server_capabilities" { completionProvider = { resolveProvider = false, triggerCharacters = { "$", "@", "%", "-", ">", ":" } }, definitionProvider = true, documentSymbolProvider = true, hoverProvider = true, textDocumentSync = 2, workspace = { workspaceFolders = { supported = true } }, workspaceSymbolProvider = true}
[INFO][2022-02-17 10:17:27] .../lua/vim/lsp.lua:922 "LSP[perlnavigator]" "initialized" { resolved_capabilities = { call_hierarchy = false, code_action = false, code_lens = false, code_lens_resolve = false, completion = true, declaration = false, document_formatting = false, document_highlight = false, document_range_formatting = false, document_symbol = true, execute_command = false, find_references = false, goto_definition = true, hover = true, implementation = false, rename = false, signature_help = false, signature_help_trigger_characters = {}, text_document_did_change = 2, text_document_open_close = true, text_document_save = true, text_document_save_include_text = false, text_document_will_save = false, text_document_will_save_wait_until = false, type_definition = false, workspace_folder_properties = { changeNotifications = false, supported = true }, workspace_symbol = true }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { jsonrpc = "2.0", method = "textDocument/didOpen", params = { textDocument = { languageId = "perl", text = "#!/usr/bin/env perl\n\nuse 5.026;\n\nuse Mojo::Base -strict, -signatures;\nuse Mojo::Util qw(dumper trim);\nuse Mojo::IOLoop;\n\nuse FindBin qw($RealBin);\nuse lib \"$RealBin/lib/\";\nuse Lutron::Caseta;\n\nuse constant {\n BRIDGE_HOST => 'lutron-02711e26',\n BRIDGE_PORT => 8081,\n};\n\n\ndie \"Unable to create caseta object: $!\" unless\n my $caseta = Lutron::Caseta->new(\n host => BRIDGE_HOST,\n port => BRIDGE_PORT,\n );\n\n$caseta\n ->ping\n ->devices\n ->set_level(1 => $ARGV[0] // 80)\n ->status(1);\n\n$caseta->on(json_read => sub ($self, $json) {\n printf \"\\n[[ %s ]] json_read\\n\", scalar localtime;\n});\n\n$caseta->on(pong => sub { say 'PONG!' });\n\n$caseta->on(zone_status => sub ($self, $status) {\n say dumper $status;\n say \"Zone Status: $status->{zone} = $status->{level}\";\n #say $status->{level} if ($status->{zone} eq '/zone/1');\n});\n\n$caseta->on(devices => sub ($self, $devices) {\n say \"Device Count: $devices->{device_count}\";\n say \"Devices:\\n\", dumper $devices->{devices};\n print \"Devices:\";\n print \"\\n \", join ' / ', $_->{FullyQualifiedName}->@*\n for $devices->{devices}->@*;\n\n print \"\\n\";\n});\n\n$caseta->listen;\n\n\n__DATA__\nJSON_READ:\n{\n \"Body\" => {\n \"ZoneStatus\" => {\n \"Level\" => 0,\n \"Zone\" => {\n \"href\" => \"/zone/1\"\n },\n \"href\" => \"/zone/1/status\"\n }\n },\n \"CommuniqueType\" => \"ReadResponse\",\n \"Header\" => {\n \"MessageBodyType\" => \"OneZoneStatus\",\n \"StatusCode\" => \"200 OK\",\n \"Url\" => \"/zone/1/status/level\"\n }\n}\n\nJSON_READ:\n{\n \"Body\" => {\n \"PingResponse\" => {\n \"LEAPVersion\" => \"1.109\"\n }\n },\n \"CommuniqueType\" => \"ReadResponse\",\n \"Header\" => {\n \"MessageBodyType\" => \"OnePingResponse\",\n \"StatusCode\" => \"200 OK\",\n \"Url\" => \"/server/1/status/ping\"\n }\n}\n\nJSON_READ:\n{\n \"Body\" => {\n \"Devices\" => [\n {\n \"DeviceRules\" => [\n {\n \"href\" => \"/devicerule/40\"\n }\n ],\n \"DeviceType\" => \"SmartBridge\",\n \"FirmwareImage\" => {\n \"Firmware\" => {\n \"DisplayName\" => \"06.09.01f000\"\n },\n \"Installed\" => {\n \"Day\" => 28,\n \"Hour\" => 3,\n \"Minute\" => 47,\n \"Month\" => 2,\n...\n \"DeviceRules\" => [\n {\n \"href\" => \"/devicerule/40\"\n }\n ],\n \"DeviceType\" => \"SmartBridge\",\n \"FirmwareImage\" => {\n \"Firmware\" => {\n \"DisplayName\" => \"06.09.01f000\"\n },\n \"Installed\" => {\n \"Day\" => 28,\n \"Hour\" => 3,\n \"Minute\" => 47,\n \"Month\" => 2,\n \"Second\" => 9,\n \"Utc\" => \"-7:00:00\",\n \"Year\" => 2019\n\n\n\ndef get_value(self, device_id):\n \"\"\"\n Will return the current level value for the device with the given ID.\n :param device_id: device id, e.g. 5\n :returns level value from 0 to 100\n :rtype int\n \"\"\"\n zone_id = self._get_zone_id(device_id)\n if zone_id:\n cmd = {\n \"CommuniqueType\": \"ReadRequest\",\n \"Header\": {\"Url\": \"/zone/%s/status\" % zone_id}}\n return self._writer.write(cmd)\n\n def is_connected(self):\n \"\"\"Will return True if currently connected to the Smart Bridge.\"\"\"\n return self.logged_in\n\n def is_on(self, device_id):\n \"\"\"\n Will return True is the device with the given ID is 'on'.\n :param device_id: device id, e.g. 5\n :returns True if level is greater than 0 level, False otherwise\n \"\"\"\n return self.devices[device_id]['current_state'] > 0\n\n def set_value(self, device_id, value):\n \"\"\"\n Will set the value for a device with the given ID.\n :param device_id: device id to set the value on\n :param value: integer value from 0 to 100 to set\n \"\"\"\n zone_id = self._get_zone_id(device_id)\n if zone_id:\n cmd = {\n \"CommuniqueType\": \"CreateRequest\",\n \"Header\": {\"Url\": \"/zone/%s/commandprocessor\" % zone_id},\n \"Body\": {\n \"Command\": {\n \"CommandType\": \"GoToLevel\",\n \"Parameter\": [{\"Type\": \"Level\", \"Value\": value}]}}}\n\n\n def _load_devices(self):\n \"\"\"Load the device list from the SSL LEAP server interface.\"\"\"\n _LOG.debug(\"Loading devices\")\n self._writer.write({\n \"CommuniqueType\": \"ReadRequest\", \"Header\": {\"Url\": \"/device\"}})\n device_json = yield from self._reader.read()\n for device in device_json['Body']['Devices']:\n _LOG.debug(device)\ndevice_id = device['href'][device['href'].rfind('/') + 1:]\n", uri = "file:///home/$USER/Sync/i7-dev/lutron/lutron.pl", version = 0 } }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 0, jsonrpc = "2.0", method = "client/registerCapability", params = { registrations = { { id = "c3d085c8-e4cb-4672-a4fa-3d66f64e6126", method = "workspace/didChangeConfiguration", registerOptions = vim.empty_dict() } } }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 1, jsonrpc = "2.0", method = "client/registerCapability", params = { registrations = { { id = "ed6b0424-cf4a-4e48-8477-420355514614", method = "workspace/didChangeWorkspaceFolders", registerOptions = vim.empty_dict() } } }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 2, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "file:///home/$USER/Sync/i7-dev/lutron/lutron.pl", section = "perlnavigator" } } }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 3, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "file:///home/$USER/Sync/i7-dev/lutron/lutron.pl", section = "perlnavigator" } } }}
[WARN][2022-02-17 10:17:27] ...lsp/handlers.lua:109 "The language server perlnavigator triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:464 "server_request: callback result" { result = vim.NIL, status = true}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { id = 0, jsonrpc = "2.0", result = vim.NIL}
[WARN][2022-02-17 10:17:27] ...lsp/handlers.lua:109 "The language server perlnavigator triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:464 "server_request: callback result" { result = vim.NIL, status = true}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { id = 1, jsonrpc = "2.0", result = vim.NIL}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:464 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { id = 2, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:464 "server_request: callback result" { result = { vim.NIL }, status = true}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { id = 3, jsonrpc = "2.0", result = { vim.NIL }}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 4, jsonrpc = "2.0", method = "workspace/workspaceFolders"}
[WARN][2022-02-17 10:17:27] .../lua/vim/lsp.lua:751 "server_request: no handler found for" "workspace/workspaceFolders"
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:464 "server_request: callback result" { err = { code = -32601, message = "MethodNotFound", <metatable> = { __tostring = <function 1> } }, status = true}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { error = { code = -32601, message = "MethodNotFound", <metatable> = { __tostring = <function 1> } }, id = 4, jsonrpc = "2.0"}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:454 "rpc.receive" { id = 5, jsonrpc = "2.0", method = "workspace/workspaceFolders"}
[WARN][2022-02-17 10:17:27] .../lua/vim/lsp.lua:751 "server_request: no handler found for" "workspace/workspaceFolders"
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:464 "server_request: callback result" { err = { code = -32601, message = "MethodNotFound", <metatable> = { __tostring = <function 1> } }, status = true}
[DEBUG][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:347 "rpc.send" { error = { code = -32601, message = "MethodNotFound", <metatable> = { __tostring = <function 1> } }, id = 5, jsonrpc = "2.0"}
[ERROR][2022-02-17 10:17:27] .../vim/lsp/rpc.lua:420 "rpc" "node" "stderr" "/home/$USER/Sync/i7-dev/PerlNavigator/server/node_modules/vscode-jsonrpc/lib/common/connection.js:477\n responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\n ^\n\nResponseError: MethodNotFound\n at handleResponse (/home/$USER/Sync/i7-dev/PerlNavigator/server/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)\n at processMessageQueue (/home/$USER/Sync/i7-dev/PerlNavigator/server/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)\n at Immediate.<anonymous> (/home/$USER/Sync/i7-dev/PerlNavigator/server/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)\n at processImmediate (node:internal/timers:464:21) {\n code: -32601,\n data: undefined\n}\n"
neovim version information:
:version
NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser
Features: +acl +iconv +tui
neovim lsp config for Perl Navigator (config hints from :help lspconfig-adding-servers):
local configs = require 'lspconfig.configs'
-- Check if the config is already defined (useful when reloading this file)
if not configs.perlnavigator then
configs.perlnavigator = {
default_config = {
cmd = { "node", "/home/$USER/dev/PerlNavigator/server/out/server.js", "--stdio" },
filetypes = { 'perl' };
root_dir = function(fname)
return lspconfig.util.find_git_ancestor(fname)
end;
settings = {};
};
}
end
lspconfig.perlnavigator.setup{}
❯ node --version
v16.13.2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (10 by maintainers)
FWIW, I also have this working, except for perltidy. For whatever reason it isn’t tidying the file. I’m still looking to see why that is. I think submitting a default config for lspconfig and possibly an installer for nvim-lsp-installer will be good next tasks (for me or some other neovim person out there).
I’m running nightly neovim, fyi. So 0.7.0-pre.
Ah, I should’ve mentioned that I replaced my actual username with the $USER string when creating this github issue. In the configs it’s the full path with my actual username everywhere.