Closed Hi-Angel closed 8 months ago
Ha! I couldn't figure out by code of lsp-mode, it's quite complicated. But I executed a bpftrace
to print new processes while executing a lsp
and found this:
pid: 40505, comm: emacs, args: /bin/zsh -c dotnet tool list -g
pid: 40505, comm: zsh, args: dotnet tool list -g
so lsp is starting this tool. Apparently it assumes the tool will print if csharp-ls
exists, but that doesn't happen, its output is empty. Even though csharp-ls
does exist 😊 Looking at lsp-csharp.el
it seems like the test for just checking if csharp-ls
binary is present is missing. So that needs to be fixed.
This looks suspicious:
Command "semgrep lsp" is not present on the path.
Can you try setting this configuration and try again:
(setq lsp-disabled-clients '(semgrep-ls))
Can you try setting this configuration and try again:
(setq lsp-disabled-clients '(semgrep-ls))
Didn't help, lsp still says csharp-ls
is not installed and asks if I want it to be installed
What is the output of which csharp-ls
?
And can you check the variable exec-path
and see the directory where csharp-ls
is present exists in this variable.
What is the output of
which csharp-ls
?
/usr/bin/csharp-ls
And can you check the variable
exec-path
and see the directory wherecsharp-ls
is present exists in this variable.
Yes, it enlists /usr/bin
As I mentioned in my comment above, I think the problem simply comes down to lsp-csharp.el
lacking the search by the name of csharp-ls
(and omnisharp
for that matter).
Ah, I missed that comment. I see what you mean.
It seems that there is actually a code that supposed to search it by name, it's in the function lsp-csharp--cls-make-launch-cmd
. However adding a (print "here")
inside it and evaluating the function and then trying to run lsp
on C# file does not show a print "hello" in the *Messages* buffer. So for some reason this function simply does not get run.
So, I am not good in lsp-mode
internals, but I would seem to me there is a bug on this line.
It would seem that the original author assumed that function (lsp-stdio-connection)
tests its args in order to find executable. But it works a bit different way. All in all, the first function that is actually supposed to return /usr/bin/csharp-ls
does not get run.
At least that's my interpretation of the situation.
The regression was introduced in 9b3a9215807af0727b514e8c7cf440bcc0bdad44
CC: @razzmatazz the author of the commit
UPD: reverting the commit fixes the problem
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
I installed
csharp-ls
and it is in$PATH
. However if I open a.cs
file and executelsp
, I get aUnable to find installed server supporting this file
error. It suggests to installomnisharp
orcsharp-ls
, but the latter is already installed.lsp-servers for C, python and bash work fine, so it is specific to just this one.
Steps to reproduce
csharp-ls
lsp-start-plain
test.cs
that has the following content:lsp
Expected behavior
csharp-ls
gets startedWhich Language Server did you use?
csharp-ls
OS
Linux
Error callstack