dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 676 forks source link

Intellisense Lost In Workspace #4425

Closed vindicatorr closed 2 weeks ago

vindicatorr commented 3 years ago

Issue Description

[info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService
        Could not find document for file <pathTo>/<fileName>.cs

This is just going to be weird and I'm still in the middle of figuring out what is happening. It began when I added a project folder to my pre-existing workspace. I've had intellisense working for other projects (including C#) in that workspace before, as well as it working for that folder opened as standalone (non-multi-root-workspace).

Ah, perfect. It failed with the first minimal replication I made.

Steps to Reproduce

Structure:

<pathTo>/operationalFolder
    workspaces
        workspace.code-workspace
    project1
        Class1.lib
        project1.csproj
    project2
        console
            Program.cs
            console.csproj
        lib
            Class1.lib
            lib.csproj
  1. Once that structure replicant.tar.gz is created, open the workspace in Visual Studio Code.
  2. "Add Folder to Workspace", adding "project2"
  3. Open "console/Program.cs" and see if intellisense works. "System."
  4. "Add Folder to Workspace", adding "project1"
  5. Open "Class1.cs" and see if intellisense works. "System."

Expected Behavior

Provide full dotnet/c# intellisense

Actual Behavior

No dotnet intellisense in "project1/Class1.cs". HOWEVER, bare minimum intellisense still works like "namespace" or "class", but not stuff like "System."

Logs

OmniSharp log

Starting OmniSharp server at 3/6/2021, 7:18:34 PM Target: /project2 OmniSharp server started. Path: /home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/run PID: 640620 [info]: OmniSharp.Stdio.Host Starting OmniSharp on arch 0.0 (x64) [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 1 MSBuild instance(s) 1: StandAlone 16.8.0 - "/home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/.msbuild/Current/Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator MSBUILD_EXE_PATH environment variable set to '/home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/.msbuild/Current/Bin/MSBuild.exe' [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 16.8.0 - "/home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/.msbuild/Current/Bin" CscToolExe = csc.exe MSBuildToolsPath = /home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/.msbuild/Current/Bin CscToolPath = /home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/.msbuild/Current/Bin/Roslyn BypassFrameworkInstallChecks = true MSBuildExtensionsPath = /home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/.msbuild [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140 [info]: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in '/project2'. [info]: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem No solution files found in '/project2' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/project2/lib/lib.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/project2/console/console.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in '/project2'. [info]: OmniSharp.Script.ScriptProjectSystem Could not find any CSX files [info]: OmniSharp.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location '/project2' on host 639678. [info]: OmniSharp.MSBuild.ProjectManager Loading project: /project2/lib/lib.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/project2/lib/lib.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/project2/lib/lib.csproj' [info]: OmniSharp.MSBuild.ProjectManager Loading project: /project2/console/console.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/project2/console/console.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Adding project '/project2/console/console.csproj' [info]: OmniSharp.MSBuild.ProjectManager Update project: lib [info]: OmniSharp.MSBuild.ProjectManager Update project: console [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/project2/lib/lib.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for '/project2/console/console.csproj' [info]: OmniSharp.MSBuild.ProjectManager Loading project: /project2/lib/lib.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/project2/lib/lib.csproj'. [info]: OmniSharp.MSBuild.ProjectManager Loading project: /project2/console/console.csproj [info]: OmniSharp.MSBuild.ProjectManager Successfully loaded project file '/project2/console/console.csproj'. Received response for /v2/blockstructure but could not find request. Received response for /v2/getcodeactions but could not find request. [info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService Could not find document for file /project1/Class1.cs Received response for /v2/blockstructure but could not find request. [info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService Could not find document for file /project1/Class1.cs [info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService Could not find document for file /project1/Class1.cs

C# log

Blank/Empty

Environment information

VSCode version: 1.54.0-insider C# Extension: 1.23.9

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.100-preview.1.21107.2 Commit: 530ae4ca95 Runtime Environment: OS Name: arch OS Version: OS Platform: Linux RID: arch-x64 Base Path: /opt/dotnet/sdk/6.0.100-preview.1.21107.2/ Host (useful for support): Version: 6.0.0-preview.2.21105.12 Commit: 0429344aa2 .NET SDKs installed: 3.1.201 [/opt/dotnet/sdk] 5.0.100 [/opt/dotnet/sdk] 6.0.100-preview.1.21107.2 [/opt/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.3 [/opt/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [/opt/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0-preview.2.21106.3 [/opt/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.3 [/opt/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [/opt/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0-preview.2.21105.12 [/opt/dotnet/shared/Microsoft.NETCore.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |cortex-debug|marus25|0.3.7| |cpptools|ms-vscode|1.1.3| |csharp|ms-dotnettools|1.23.9| |msbuild-project-tools|tintoy|0.3.15| |vscode-nuget-package-manager|jmrog|1.1.6| |xml|DotJoshJohnson|2.5.0|;
JoeRobich commented 2 weeks ago

duplicate of https://github.com/dotnet/vscode-csharp/issues/1889