OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.7k stars 169 forks source link

OmniSharp errors during linting #806

Closed darius-grauslys closed 2 years ago

darius-grauslys commented 2 years ago

System Specs

OS

Linux Distro: Void Linux https://voidlinux.org/ Kernel Version: 5.18.19_1 Csharp netcore 6.0 (dotnet)

nvim -v

NVIM v0.7.2 Build type: Release LuaJIT 2.1.0-beta3 Compiled by void-buildslave@a-fsn-de5.18.19_1

Issue

Please see if the error can be replicated with the following Csharp code:

5.18.19_1public abstract class Base_Class
<
    TThis_Base
>
where TThis_Base : Base_Class<TThis_Base>
{
}

public class Expand_Base
<
    TThis_Expansion,
    TChild
> :
Base_Class
<
    TThis_Expansion
>
where TThis_Expansion :
    Expand_Base<TThis_Expansion, TChild>
where TChild :
    Expand_Base<TThis_Expansion, TChild>
    .Child<TThis_Expansion, TChild>
{
    public class Child<TParent, TThis_Child>
    where TParent : Expand_Base<TThis_Expansion, TChild>
    where TThis_Child : Child<TParent, TThis_Child>
    {
    }
}

Rewriting, under Expand_Base:

where TChild :
    Expand_Base<TThis_Expansion, TChild>
    .Child<TThis_Expansion, TChild>

Will result into numerous amounts of errors. Code however, compiles with dotnet.

nickspoons commented 2 years ago

Are you using the net6 build of the server, or the default mono version? If not using the net6 version please try it:

Add this to your .vimrc:

let g:OmniSharp_server_use_net6 = 1

Then re-install the server with :OmniSharpInstall

If you still have problems, then attach a log (:OmniSharpOpenLog)

darius-grauslys commented 2 years ago

I had a git-clone and compiled version of OmniSharp with a OmniSharp_server_path in my .vimrc (specifically, init.vim.) Removing the OmniSharp_server_path and using let g:OmniSharp_server_use_net6 = 1 followed up with an :OmniSharpInstall still results in the same behavior with the bug-replication code.

Here is the :OmniSharpOpenLog

NVIM v0.7.2

OmniSharp server started.
    Path: /home/user/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp
    Target: /home/user/Bug_Recreations/csharp/sub_class__of_generic
    PID: 2128

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to /home/user/.dotnet/dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: .NET Core SDK 6.0.302 17.2.0 - "/home/user/.dotnet/sdk/6.0.302/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.302 17.2.0 - "/home/user/.dotnet/sdk/6.0.302/"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/home/user/Bug_Recreations/csharp/sub_class__of_generic'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/user/Bug_Recreations/csharp/sub_class__of_generic/sub_class__of_generic.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/user/Bug_Recreations/csharp/sub_class__of_generic'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/user/Bug_Recreations/csharp/sub_class__of_generic' on host -1.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/user/Bug_Recreations/csharp/sub_class__of_generic/sub_class__of_generic.csproj
[info]: OmniSharp.OmniSharpWorkspace
        Miscellaneous file: /home/user/Bug_Recreations/csharp/sub_class__of_generic/Program.cs added to workspace
Replaying requests for buffer 1
[info]: OmniSharp.MSBuild.ProjectManager                                   
        Successfully loaded project file '/home/user/Bug_Recreations/csharp/sub_class__of_generic/sub_class__of_generic.csproj'.
All projects loaded
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/user/Bug_Recreations/csharp/sub_class__of_generic/sub_class__of_generic.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: sub_class__of_generic
Workspace complete: 1 project(s)
Replaying on-load requests
nickspoons commented 2 years ago

Ok that log looks fine, and OmniSharp-vim appears to be working correctly. If you're getting errors that you think are incorrect, they are coming from the server so you'll need to open an issue with OmniSharp-roslyn

darius-grauslys commented 2 years ago

Thanks, I made a new issue over there https://github.com/OmniSharp/omnisharp-roslyn/issues/2448