Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when used with neovim LSP #1

Closed
rage311 opened this issue Feb 17, 2022 · 20 comments
Closed

Crashes when used with neovim LSP #1

rage311 opened this issue Feb 17, 2022 · 20 comments

Comments

@rage311
Copy link

rage311 commented Feb 17, 2022

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
@WhoIsSethDaniel
Copy link
Contributor

hi, the very last line of the log you posted suggests to me that $USER is not being expanded. Perhaps try filling in your actual username in the neovim config and see if it works?

@rage311
Copy link
Author

rage311 commented Feb 17, 2022

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.

@sdondley
Copy link

sdondley commented Mar 2, 2022

OK, finally got it working. I didn't know what the hell tsc was and finally figured out I had to install typescript. Then it took me 1/2 hour to realize I was trying to run a perl file outside of a git repo so it wasn't kicking in.

Anyway, here's what I got:

vim.lsp.set_log_level 'trace'
require('vim.lsp.log').set_format_func(vim.inspect)
local lspconfig = require'lspconfig'
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 = { "/usr/local/bin/node", "/Users/me/git_repos/PerlNavigator/server/out/server.js", "--stdio" },
     root_dir = function(fname)
       return lspconfig.util.find_git_ancestor(fname)
     end;
     filetypes = { 'perl' };
     settings = { };
   };
  }
end

lspconfig.perlnavigator.setup{ }

The bad news is that I'm getting an error. Here's the lsp log from neovim with debug turned on. I have no idea what I'm looking at:

[START][2022-03-02 12:19:02] LSP logging initiated
[INFO][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:261	"Starting RPC client"	{
  args = { "/Users/stevedondley/git_repos/PerlNavigator/server/out/server.js", "--stdio" },
  cmd = "/usr/local/bin/node",
  extra = {
    cwd = "/Users/stevedondley/git_repos/mojo"
  }
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:892	"LSP[perlnavigator]"	"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 = 37632,
  rootPath = "/Users/stevedondley/git_repos/mojo",
  rootUri = "file:///Users/stevedondley/git_repos/mojo",
  trace = "off",
  workspaceFolders = { {
      name = "/Users/stevedondley/git_repos/mojo",
      uri = "file:///Users/stevedondley/git_repos/mojo"
    } }
}
[DEBUG][2022-03-02 12:19:02] .../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 = 37632,
    rootPath = "/Users/stevedondley/git_repos/mojo",
    rootUri = "file:///Users/stevedondley/git_repos/mojo",
    trace = "off",
    workspaceFolders = { {
        name = "/Users/stevedondley/git_repos/mojo",
        uri = "file:///Users/stevedondley/git_repos/mojo"
      } }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 1,
  jsonrpc = "2.0",
  result = {
    capabilities = {
      completionProvider = {
        resolveProvider = false,
        triggerCharacters = { "$", "@", "%", "-", ">", ":" }
      },
      definitionProvider = true,
      documentFormattingProvider = true,
      documentRangeFormattingProvider = true,
      documentSymbolProvider = true,
      hoverProvider = true,
      textDocumentSync = 2,
      workspace = {
        workspaceFolders = {
          supported = true
        }
      },
      workspaceSymbolProvider = true
    }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  jsonrpc = "2.0",
  method = "initialized",
  params = vim.empty_dict()
}
[DEBUG][2022-03-02 12:19:02] .../lua/vim/lsp.lua:921	"LSP[perlnavigator]"	"server_capabilities"	{
  completionProvider = {
    resolveProvider = false,
    triggerCharacters = { "$", "@", "%", "-", ">", ":" }
  },
  definitionProvider = true,
  documentFormattingProvider = true,
  documentRangeFormattingProvider = true,
  documentSymbolProvider = true,
  hoverProvider = true,
  textDocumentSync = 2,
  workspace = {
    workspaceFolders = {
      supported = true
    }
  },
  workspaceSymbolProvider = true
}
[INFO][2022-03-02 12:19:02] .../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 = true,
    document_highlight = false,
    document_range_formatting = true,
    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-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  jsonrpc = "2.0",
  method = "textDocument/didOpen",
  params = {
    textDocument = {
      languageId = "perl",
      text = "\n",
      uri = "file:///Users/stevedondley/git_repos/mojo/test.pl",
      version = 0
    }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 0,
  jsonrpc = "2.0",
  method = "client/registerCapability",
  params = {
    registrations = { {
        id = "9f1be352-8856-4135-ba1b-119a7f5ca1ea",
        method = "workspace/didChangeConfiguration",
        registerOptions = vim.empty_dict()
      } }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 1,
  jsonrpc = "2.0",
  method = "client/registerCapability",
  params = {
    registrations = { {
        id = "ec53bd8e-2cd0-4b3e-b108-3df754259056",
        method = "workspace/didChangeWorkspaceFolders",
        registerOptions = vim.empty_dict()
      } }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 2,
  jsonrpc = "2.0",
  method = "workspace/configuration",
  params = {
    items = { {
        scopeUri = "file:///Users/stevedondley/git_repos/mojo/test.pl",
        section = "perlnavigator"
      } }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 3,
  jsonrpc = "2.0",
  method = "workspace/configuration",
  params = {
    items = { {
        scopeUri = "file:///Users/stevedondley/git_repos/mojo/test.pl",
        section = "perlnavigator"
      } }
  }
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:745	"server_request"	"client/registerCapability"	{
  registrations = { {
      id = "9f1be352-8856-4135-ba1b-119a7f5ca1ea",
      method = "workspace/didChangeConfiguration",
      registerOptions = vim.empty_dict()
    } }
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:748	"server_request: found handler for"	"client/registerCapability"
[TRACE][2022-03-02 12:19:02] ...lsp/handlers.lua:437	"default_handler"	"client/registerCapability"	{
  ctx = '{\n  client_id = 1,\n  method = "client/registerCapability"\n}',
  result = {
    registrations = { {
        id = "9f1be352-8856-4135-ba1b-119a7f5ca1ea",
        method = "workspace/didChangeConfiguration",
        registerOptions = vim.empty_dict()
      } }
  }
}
[WARN][2022-03-02 12:19:02] ...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-03-02 12:19:02] .../vim/lsp/rpc.lua:464	"server_request: callback result"	{
  result = vim.NIL,
  status = true
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  id = 0,
  jsonrpc = "2.0",
  result = vim.NIL
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:745	"server_request"	"client/registerCapability"	{
  registrations = { {
      id = "ec53bd8e-2cd0-4b3e-b108-3df754259056",
      method = "workspace/didChangeWorkspaceFolders",
      registerOptions = vim.empty_dict()
    } }
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:748	"server_request: found handler for"	"client/registerCapability"
[TRACE][2022-03-02 12:19:02] ...lsp/handlers.lua:437	"default_handler"	"client/registerCapability"	{
  ctx = '{\n  client_id = 1,\n  method = "client/registerCapability"\n}',
  result = {
    registrations = { {
        id = "ec53bd8e-2cd0-4b3e-b108-3df754259056",
        method = "workspace/didChangeWorkspaceFolders",
        registerOptions = vim.empty_dict()
      } }
  }
}
[WARN][2022-03-02 12:19:02] ...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-03-02 12:19:02] .../vim/lsp/rpc.lua:464	"server_request: callback result"	{
  result = vim.NIL,
  status = true
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  id = 1,
  jsonrpc = "2.0",
  result = vim.NIL
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:745	"server_request"	"workspace/configuration"	{
  items = { {
      scopeUri = "file:///Users/stevedondley/git_repos/mojo/test.pl",
      section = "perlnavigator"
    } }
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:748	"server_request: found handler for"	"workspace/configuration"
[TRACE][2022-03-02 12:19:02] ...lsp/handlers.lua:437	"default_handler"	"workspace/configuration"	{
  ctx = '{\n  client_id = 1,\n  method = "workspace/configuration"\n}',
  result = {
    items = { {
        scopeUri = "file:///Users/stevedondley/git_repos/mojo/test.pl",
        section = "perlnavigator"
      } }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:464	"server_request: callback result"	{
  result = { vim.NIL },
  status = true
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  id = 2,
  jsonrpc = "2.0",
  result = { vim.NIL }
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:745	"server_request"	"workspace/configuration"	{
  items = { {
      scopeUri = "file:///Users/stevedondley/git_repos/mojo/test.pl",
      section = "perlnavigator"
    } }
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:748	"server_request: found handler for"	"workspace/configuration"
[TRACE][2022-03-02 12:19:02] ...lsp/handlers.lua:437	"default_handler"	"workspace/configuration"	{
  ctx = '{\n  client_id = 1,\n  method = "workspace/configuration"\n}',
  result = {
    items = { {
        scopeUri = "file:///Users/stevedondley/git_repos/mojo/test.pl",
        section = "perlnavigator"
      } }
  }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:464	"server_request: callback result"	{
  result = { vim.NIL },
  status = true
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  id = 3,
  jsonrpc = "2.0",
  result = { vim.NIL }
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 4,
  jsonrpc = "2.0",
  method = "workspace/workspaceFolders"
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:745	"server_request"	"workspace/workspaceFolders"	nil
[WARN][2022-03-02 12:19:02] .../lua/vim/lsp.lua:751	"server_request: no handler found for"	"workspace/workspaceFolders"
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:464	"server_request: callback result"	{
  err = {
    code = -32601,
    message = "MethodNotFound",
    <metatable> = {
      __tostring = <function 1>
    }
  },
  status = true
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  error = {
    code = -32601,
    message = "MethodNotFound",
    <metatable> = {
      __tostring = <function 1>
    }
  },
  id = 4,
  jsonrpc = "2.0"
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 5,
  jsonrpc = "2.0",
  method = "workspace/workspaceFolders"
}
[TRACE][2022-03-02 12:19:02] .../lua/vim/lsp.lua:745	"server_request"	"workspace/workspaceFolders"	nil
[WARN][2022-03-02 12:19:02] .../lua/vim/lsp.lua:751	"server_request: no handler found for"	"workspace/workspaceFolders"
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:464	"server_request: callback result"	{
  err = {
    code = -32601,
    message = "MethodNotFound",
    <metatable> = {
      __tostring = <function 1>
    }
  },
  status = true
}
[DEBUG][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  error = {
    code = -32601,
    message = "MethodNotFound",
    <metatable> = {
      __tostring = <function 1>
    }
  },
  id = 5,
  jsonrpc = "2.0"
}
[ERROR][2022-03-02 12:19:02] .../vim/lsp/rpc.lua:420	"rpc"	"/usr/local/bin/node"	"stderr"	"/Users/stevedondley/git_repos/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 (/Users/stevedondley/git_repos/PerlNavigator/server/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)\n    at processMessageQueue (/Users/stevedondley/git_repos/PerlNavigator/server/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)\n    at Immediate.<anonymous> (/Users/stevedondley/git_repos/PerlNavigator/server/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)\n    at processImmediate (node:internal/timers:466:21) {\n  code: -32601,\n  data: undefined\n}\n\nNode.js v17.6.0\n"

@bscan
Copy link
Owner

bscan commented Mar 2, 2022

Thanks! Looks like both of these reports showing crashing on workspace/workspaceFolders in Neovim 0.6.1. This feature was only added to neovim very recently and is not be part of the latest official release of 0.6.1. I will add some error handling to fall back to an empty list when workspaceFolders are not available (or initialize them in a different location). Alternatively, you could try updating to the neovim 0.7.0 prerelease.

See neovim/neovim#17149

@WhoIsSethDaniel
Copy link
Contributor

WhoIsSethDaniel commented Mar 2, 2022

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.

@WhoIsSethDaniel
Copy link
Contributor

and my tidy issue was a configuration issue. I forgot the perlnavigator key in my config. Here is my (redacted) config:

return {
  settings = {
    perlnavigator = {
      perlPath = '/usr/local/bin/perl',
      perlcriticProfile = '/home/seth/xxx/.perlcriticrc',
      perltidyProfile = '/home/seth/xxx/perltidyrc',
    },
  },
}

I setup the server just like people above:

local configs = require 'lspconfig.configs'
configs['perlnavigator'] = {
  default_config = {
    cmd = { 'node', '/home/seth/src/PerlNavigator/server/out/server.js', '--stdio' },
    root_dir = function(fname)
      return require('lspconfig').util.find_git_ancestor(fname)
    end,
    filetypes = { 'perl' },
    settings = {},
  },
}

@bscan
Copy link
Owner

bscan commented Mar 2, 2022

@WhoIsSethDaniel thanks for testing and putting this together. I greatly appreciate it. Any feedback on the extension itself? I'm curious how well it works in Neovim.

If you would be willing to add the config back to lspconfig, that would be awesome. I'm not a neovim person, but lspconfig seems like it would be the right place to start.

For the installer, there's currently an open ticket for a Perl server. Looks like people got stuck installing Perl modules from cpan. I've had similar issues in the past, and fixing it was one of the primary design goals. The Perl Navigator bundles all of its Perl dependencies directly in the server itself. williamboman/nvim-lsp-installer#316

@WhoIsSethDaniel
Copy link
Contributor

Thanks @bscan. I don't really get the "I can't install the appropriate perl modules" complaint. My problem is working with typescript and javascript. I have no idea what I'm doing. But not everyone knows the ins-and-outs of cpanm or cpm.

@sdondley
Copy link

sdondley commented Mar 2, 2022

I'm on a mac and use brew to install neovim. Tried using it to upgrade to --HEAD but got an error while compiling. I'll just have to wait, I guess.

@bscan
Copy link
Owner

bscan commented Mar 3, 2022

@WhoIsSethDaniel The design for the Perl Navigator is essentially "vscode handles the typescript environment, and the Perl dependencies are bundled in", which means the average vscode user can simply install from the marketplace and it should just work. This multi-language design can complicate things for other editors though.

As for installation issues for Perl::LanguageServer, I've seen a few issues mentioned, often centering around Coro and libanyevent-perl. Some are mentioned in the comment thread here: https://dev.to/perldean/vscode-as-a-perl-ide-3cco . Also, my understanding is that Coro is technically not supported on Perl versions > 5.22 (although it does seem to generally work) and will throw warnings that get hidden by cpanm ( https://metacpan.org/dist/Canary-Stability/source/Stability.pm ). Perl::LanguageServer also doesn't yet work on Windows, which is a blocker for many users.

@sdondley, I just pushed a commit that will allow the Navigator to continue in the event that the client doesn't respond with workspaceFolders. It only impacts a very minor feature (the ability to specify $workspaceRoot in includePaths and profile path). I'm still not clear if the Server or the Client is crashing, so I might need to stop making requests entirely to that API if this fix doesn't work. Thanks again.

@sdondley
Copy link

sdondley commented Mar 3, 2022

Yessiree, works! Nice work. Haven't played with it all yet.

@sdondley
Copy link

sdondley commented Mar 3, 2022

OK, both perl critic and syntax highlighting work. perltidy doesn't seem to do anything. I confirmed perltidy straight works from the command line and generates an output file with cleaned code. I've never used an IDE so I'm not sure what to look for, though.

I ran this command in nvim:

:lua vim.lsp.buf.formatting()

No errors, but nothing happens. Badly indented code remains the same. Debug log shows something is happening, though:

`[DEBUG][2022-03-03 01:06:57] .../lua/vim/lsp.lua:962	"LSP[perlnavigator]"	"client.request"	1	"textDocument/formatting"	{
  options = {
    insertSpaces = true,
    tabSize = 4
  },
  textDocument = {
    uri = "file:///Users/stevedondley/git_repos/mojo/test.pl"
  }
}	<function 1>	1
[DEBUG][2022-03-03 01:06:57] .../vim/lsp/rpc.lua:347	"rpc.send"	{
  id = 4,
  jsonrpc = "2.0",
  method = "textDocument/formatting",
  params = {
    options = {
      insertSpaces = true,
      tabSize = 4
    },
    textDocument = {
      uri = "file:///Users/stevedondley/git_repos/mojo/test.pl"
    }
  }
}
[DEBUG][2022-03-03 01:06:57] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  id = 4,
  jsonrpc = "2.0"
}
[TRACE][2022-03-03 01:06:57] ...lsp/handlers.lua:437	"default_handler"	"textDocument/formatting"	{
  ctx = '{\n  bufnr = 1,\n  client_id = 1,\n  method = "textDocument/formatting",\n  params = {\n    options = {\n      insertSpaces = true,\n      tabSize = 4\n    },\n    textDocument = {\n      uri = "file:///Users/stevedondley/git_repos/mojo/test.pl"\n    }\n  }\n}'
}

@sdondley
Copy link

sdondley commented Mar 3, 2022

OK perltidy is working. Just saw how @WhoIsSethDaniel set it up.

@WhoIsSethDaniel
Copy link
Contributor

@rage311 were you ever able to get neovim working with perlnavigator?

@sdondley
Copy link

Me? yes. Wrote a little tutorial for it, but it's probably already out of date: https://climatechangechat.com/fast_as_fuck_perl_language_server_and_completion.html

@sdondley
Copy link

oh, missed the tag. not for me.

@rage311
Copy link
Author

rage311 commented Apr 15, 2022

@rage311 were you ever able to get neovim working with perlnavigator?

Whoops, missed this.

I haven't tried again since, but now that neovim 0.7.0 is out I'm going to give it another try.

@bscan
Copy link
Owner

bscan commented Apr 16, 2022

@rage311 , thanks! I'm interested in your feedback. It also now works with older versions of Neovim < 0.7 with a slightly degraded feature set. I'm curious on your experiences though, especially on Perltidy. Re-reading this thread, it looks like Perltidy might not be working with the default config settings.

@rage311
Copy link
Author

rage311 commented Apr 18, 2022

It seems to work reasonably well in a proper Perl project directory. I've only scratched the surface though, so far.

When I go to edit a single Perl file in an otherwise empty directory though, I get this message:
[lspconfig] Autostart for perlnavigator failed: matching root directory not detected.

I think it's looking for a .git directory for the project root? I wonder if it's possible for it to fall back to the current directory if it can't find that.

With the below config, perltidy seems to work just fine when manually running: :lua vim.lsp.buf.formatting(). If I remove the perltidyProfile config bit, running that same lua command doesn't appear to do anything.

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/me/dev/PerlNavigator/server/out/server.js", "--stdio" },
      filetypes = { 'perl' };
      
      root_dir = function(fname)
        return lspconfig.util.find_git_ancestor(fname)
      end;
      settings = {
        perlnavigator = {
          perltidyProfile = "/home/me/.perltidyrc"
        }
      }
    }
  }
end

lspconfig.perlnavigator.setup{}

@bscan
Copy link
Owner

bscan commented Jan 14, 2023

Just going through and trying to clean up some tickets. This one seems to be resolved as many people use the Navigator with neovim now. If there are any other issues, feel free to re-open this ticket or submit a new one. Thanks!

@bscan bscan closed this as completed Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants