richterger / Perl-LanguageServer

Language Server for Perl
Other
225 stars 52 forks source link

Problems related to cacheDir? #195

Open doronbehar opened 1 year ago

doronbehar commented 1 year ago

Hello,

I'm trying to use the language server with Neovim and Lspconfig. I'm seeing the following weird errors in the log:

[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    "LS: apply_all_roles (Perl::LanguageServer=HASH(0x2d0a500), Perl::LanguageServer::Methods, Perl/LanguageServer/Methods.pm)\n"
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    "LS: apply_all_roles (Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x2d0a500), Perl::LanguageServer::Methods::workspace, Perl/LanguageServer/Methods/workspace.pm)\n"
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    'LS: perl = {\n  fileFilter => [".pm", ".pl"],\n  ignoreDirs => ".git",\n  perlCmd    => "perl",\n  perlInc    => " ",\n}\nLS: path_map = undef\nLS: perlinc = [" "]\n'
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    'LS: file_filter_regex = "(?:\\\\.pm|\\\\.pl)\\$"\nLS: ignore_dir = { ".git" => 1 }\n'
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    "state_dir = /home/doron/repos/tmux-url-select/.vscode/perl-lang\n"
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    'LS: perl = {\n  fileFilter => [".pm", ".pl"],\n  ignoreDirs => ".git",\n  perlCmd    => "perl",\n  perlInc    => " ",\n}\nLS: path_map = undef\nLS: perlinc = [" "]\n'
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    'LS: file_filter_regex = "(?:\\\\.pm|\\\\.pl)\\$"\nLS: ignore_dir = { ".git" => 1 }\n'
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    "state_dir = /home/doron/repos/tmux-url-select/.vscode/perl-lang\n"
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    "LS: apply_all_roles (Moose::Meta::Class::__ANON__::SERIAL::2=HASH(0x2d0a500), Perl::LanguageServer::Methods::textDocument, Perl/LanguageServer/Methods/textDocument.pm)\n"
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    'LS: background_parser folders = {\n  "file:///home/doron/repos/tmux-url-select" => "/home/doron/repos/tmux-url-select",\n}\n'
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    'LS: background_parser folders = {\n  "file:///home/doron/repos/tmux-url-select" => "/home/doron/repos/tmux-url-select",\n}\n'
[ERROR][2023-09-23 12:36:11] .../vim/lsp/rpc.lua:734    "rpc"   "/home/doron/.nix-profile/bin/perl" "stderr"    "Cannot make /home/doron/repos/tmux-url-select/.vscode/perl-lang//home/doron/repos/tmux-url-select/.vscode/perl-lang/home (File exists) at /nix/store/0qznwgs5r28hlxqad2kgdkglc3bclrvy-perl-5.38.0-env/lib/perl5/site_perl/5.38.0/Perl/LanguageServer/Workspace.pm line 134.\n"

And the language server exits with code 17 when I start to edit files etc. Any idea why that happens? Here's the relevant Lua code:

https://github.com/doronbehar/nvim-lspconfig/blob/perlls--version/lua/lspconfig/server_configurations/perlls.lua

I'm linking my branch due to https://github.com/neovim/nvim-lspconfig/pull/2828 .

doronbehar commented 1 year ago

Now I managed to change the default cacheDir to ~/.perlls, and I observe there are way too many folders created there:

$ find ~/.perlls
/home/doron/.perlls
/home/doron/.perlls/home
/home/doron/.perlls/home/doron
/home/doron/.perlls/home/doron/repos
/home/doron/.perlls/home/doron/repos/tmux-url-select
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/.vscode
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/.vscode/perl-lang
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/.vscode/perl-lang/home
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/tmux-url-select.pl
/home/doron/.perlls/home/doron/repos/tmux-url-select/.vscode/perl-lang/home/doron/repos/tmux-url-select/tmux-url-select.pl
/home/doron/.perlls/home/doron/repos/tmux-url-select/tmux-url-select.pl

And at least the server doesn't exit now. However, I don't get completions (I do get completion with other language servers). Also, the vars json key found in the tmux-url-select.pl json file contains an empty []:

{"vars":[],"version":5}
richterger commented 1 year ago

Please remove .vscode/perllang to avoid the extra dirs .

I have no knowlegde about neovim lsp.

Perl::LangaugeServer does support a lot of features, but no autocompletion. Any the json file should contain the symbols from the perl file.

doronbehar commented 1 year ago

Please remove .vscode/perllang to avoid the extra dirs .

Done. No difference in behavior.

Perl::LangaugeServer does support a lot of features, but no autocompletion.

Surprising... I thought that if symbols are detected, then autocompletion is available automatically.

Any the json file should contain the symbols from the perl file.

You mean that the fact I have empty vars in that json file is a sign of something not functioning properly?

doronbehar commented 1 year ago

I will note that Perl-LanguageServer is able to detect syntax issues, which is rather satisfying.

richterger commented 1 year ago

If vars are empty and you have symbols in the file, then something is going wrong. You can try to set log-level to 2 and take a look at the output pane of Perl-Lanaguage-Server