Closed chris-clark-serverless closed 5 months ago
Don't worry about that "Available Linters" line in :ALEInfo
, that only lists ALE internal linters. As long as :echo g:ale_linters.cs
outputs ['OmniSharp']
you should be fine, and it looks like your g:ale_linters
setting should do that.
Have a look at the log to see if there are any issues with the server: :OmniSharpOpenLog
Seems like failures around
44 [warn]: OmniSharp.Stdio.Host 45 +-- 11 lines: ************ Request
56 [fail]: OmniSharp.Stdio.Host
and
[fail]: OmniSharp.MSBuild.ProjectManager
Error occurred while processing project updates
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
Yeah the server isn't running properly. I can't tell more from the partial log
dotnet
?Apologies for giving the wrong log. I opened up the git bash one and ran the :OmniSharpOpenLog command.
I had attempted to do it there first, but then ran across an older issue where you recommend wsl. it is wsl 2.
There is only one Log Error on the WSL 2 Ubuntu instance.
I haven't even built the project. Didn't know this lsp required a successful build of a project first. I will go try that after providing this configuration.
call plug#begin()
Plug 'dense-analysis/ale'
Plug 'OmniSharp/omnisharp-vim'
call plug#end()
let g:OmniSharp_translate_cygwin_wsl = 1
let g:ale_linters_explicit = 1
let g:ale_completion_enabled = 1
set omnifunc=ale#completion#OmniFunc
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_hover_to_preview = 1
let g:ale_fix_on_save = 1
let g:ale_linters = { 'javascript': ['eslint', 'tsserver'], 'typescript': ['eslint', 'tsserver'],
\ 'rust': ['analyzer'], 'zig': ['zls'], 'python': ['pyright'], 'cs' : ['OmniSharp']
\ }
No it doesn't need a built project, but it's relevant whether the file paths are Windows style or unix style. Did you create the project on the WSL side, e.g. with dotnet new ...
?
If you are running/building/developing in WSL then you shouldn't use let g:OmniSharp_translate_cygwin_wsl = 1
, that setting is for converting all paths from unix to Windows in server communications.
Instead, you should use let g:OmniSharp_server_use_net6 = 1
, and reinstall the server with :OmniSharpInstall
, which will install a dotnet6+ build of OmniSharp-roslyn
After a successful build with no Errors, and no Warnings. I uninstalled omnisharp-vim and set to use net6. I reinstalled omnisharp-vim and ran OmniSharpInstall. The path shown in output mentioned net 6. and the installation is there.
omnisharp-linux-x64-net6.0.tar.gz
is in the path where the Install command showed. and found the OmniSharp
executable in the same directory /home/chris/.cache/omnisharp-vim
When attempting to open the same cs file I now get
channel 0 buffered: 'The .NET runtime can be found at:'
and if I run :OmniSharpRestartServer
it shows channel 3 open: 'The .NET runtime can be found at:'
in the command window instead
Can you share the log please?
If you run dotnet --info
you'll see the sdks and runtimes you have installed. You might be missing something, you might need to install the sdk - that error you've copied looks like it's only part of the message.
That error is not in the logs, just in the command window when opening a cs file.
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37), Included patches: 1-749
OmniSharp server started.
Path: /home/chris/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp
Target: /home/chris/source/project/file.sln
PID: 212242
Is it recommended to use wsl2 tunnel to windows and build on windows, or build within wsl2?
dotnet --info output
.NET SDK:
Version: 8.0.302
Commit: ef14e02af8
Workload version: 8.0.300-manifests.f6879a9a
MSBuild version: 17.10.4+10fbfbf2e
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /home/chris/.dotnet/sdk/8.0.302/
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 8.0.6
Architecture: x64
Commit: 3b8b000a0e
.NET SDKs installed:
6.0.423 [/home/chris/.dotnet/sdk]
8.0.302 [/home/chris/.dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.31 [/home/chris/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [/home/chris/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.31 [/home/chris/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [/home/chris/.dotnet/shared/Microsoft.NETCore.App]
When I run :OmniSharpRestartServer
I get in the command window
channel 3 open: ' - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=6.0.0-preview.7.21317.1'
Where does Omnisharp look for an installed sdk?
My path in .zshrc
export PATH="$PATH:$HOME/.local/bin:$HOME/.dotnet"
Is it recommended to use wsl2 tunnel to windows and build on windows, or build within wsl2?
I don't recommend it. The only reason you'd do that is if you are using something on the Windows side, like Visual Studio, and need to switch between VS and vim. If you're exclusively developing in WSL, that makes things much simpler.
Where does Omnisharp look for an installed sdk?
This is server configuration stuff, it's outside my area. But I think it's just using $PATH
, yes.
It might be worth taking vim out of the picture for a bit and try just running the server manually.
cd /path/to/project/or/sln
~/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp -l debug
That will produce hopefully a lot of output that you can use to deduce what it's missing, and where it's looking.
My path in
.zshrc
I'm really not sure if this can have an effect but my understanding is that ~/.zshrc
is for interactive shell configuration, and for things that other tools use outside of shells, you use ~/.zshenv
. That's where I keep my $PATH
stuff. Worth a try?
Where does Omnisharp look for an installed sdk?
This is server configuration stuff, it's outside my area. But I think it's just using
$PATH
, yes.It might be worth taking vim out of the picture for a bit and try just running the server manually.
cd /path/to/project/or/sln ~/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp -l debug
That will produce hopefully a lot of output that you can use to deduce what it's missing, and where it's looking.
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/home/chris/.cache/omnisharp-vim/omnisharp-roslyn/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=6.0.0-preview.7.21317.1
I added DOTNET_ROOT
to my ~/.zshrc
and I now have seemingly all lsp capabilities :) Thank you very much @nickspoons !
After a while of having this going since I need to make progress now, I will make the adjustment to work across windows/wsl boundary at a later time.
I have ALE installed, and omnisharp-vim installed with Plug.
I am on WSL ubuntu. I can see the ale_linters directory in omnisharp vim in my local plugged folder. Everything looks good there.
It appears the omnisharp option is not available. I have ran
:OmnisharpInstall
And it appears to be running well.
Output of :OmniSharpStatus
pid: 10207 Loaded server for /home/chris/path/SolutionName.sln in 7.8sOutput of :ALEInfo
Available Linters: ['csc', 'cspell', 'mcs', 'mcsc']edit Forgot to mention that I have set the ale_linters as well