OmniSharp/omnisharp-roslyn

LSP rootUri is ignored in favor of cwd (regression?)

krobelus opened this issue · 0 comments

Commit 30db3e0 (Updated host to use provided solution file., 2021-02-28) from #2099
seems to have regressed rootUri handling (cc @david-driscoll).

Before that commit, initializeParams.RootUri was always used if non-null.
After that commit, application.ApplicationRoot was always used if non-null, potentially overriding a non-null initializeParams.RootUri.

Specifically, if there are two projects

someproject.sln
somesubproject/somesubproject.sln

and if OmniSharp is started with somesubproject/ as working directory,
then application.ApplicationRoot will be somesubproject/,
even if initializeParams.RootUri sent by the LSP requests to use the parent directory.

My guess is that the reason for this commit was to enable a user override with the omnisharp -s.
That's fine but I don't think the override should happen when starting OmniSharp without -s.

It is wrong in this case because OmniSharp uses only the current working directory to determine application.ApplicationRoot;
but the LSP client also uses the current file, which may be outside the working directory.

Originally reported at kakoune-lsp/kakoune-lsp#746