richterger / Perl-LanguageServer

Language Server for Perl
Other
224 stars 53 forks source link

Workspace symbol not populated when trying to use this Language server from 'neovim' #17

Closed PrajitP closed 4 years ago

PrajitP commented 4 years ago

Note

I don't think this is bug. It is mostly me trying to figure out how to configure this language server to work with 'vim' or 'neovim'.

Given that all the code exist and is also being in used, and is tested with vscode. I am trying to understand how vscode language client works, specially when are method related to workspace get trigger and what is the content of those methods.

Once I figure this out I will configure my neovim language client to send that command and also document it for others.

TODO

How to reproduce

let g:LanguageClient_serverCommands = { \ 'perl': ['perl', '-MPerl::LanguageServer', '-e', 'Perl::LanguageServer::ru n', '--', '--debug', '--version', '2.1.0'], \ } let g:LanguageClient_loggingFile = expand('~/LanguageClient.log') let g:LanguageClient_serverStderr = expand('~/LanguageClientStderr.log') let g:LanguageClient_loggingLevel='DEBUG'

* Running the server on Perl code
```perl
my $string = "This is a test";
print $string, "\n";

Issue

After debugging found that the, symbols attribute for $workspace(Perl::LanguageServer::Workspace) are not populated. As a result of it, 2 of functionality definitionProvider and referencesProvider which depends on 'workspace symbols' don't work. Looking through code I found that in module Perl::LanguageServer there is a method

sub parsews {
    ...
}

which populates the symbols for workspace, but looks like it not called from anywhere in the code.

Module Perl::LanguageServer::Methods::workspace also has 2 method

sub _rpcnot_didChangeConfiguration {
    ...
}

sub _rpcnot_didChangeWorkspaceFolders {
    ...
}

were symbols for workspace are populated, I am trying to figure out how and when to trigger them form 'neovim client'.

PrajitP commented 4 years ago

It turn out LanguageClient-neovim I am using does not support workspace/workspaceFolders feature.

Perl::LanguageServer::Parser->background_parser() only parse workspace from 'workspace folder'.

Not sure if it's write design, but I think it should also parse 'rootURI' directory as it is consider as default root if 'workspace folder' is missing.

richterger commented 4 years ago

Fixed in commit 19721b14f8dbd1f0c84d7dee6d11f82dbdcb3157