dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

C# Intellisense not starting #3885

Open EthanVanderHorn opened 4 years ago

EthanVanderHorn commented 4 years ago

Issue Description

C# Intellisense not working. All of the C#, .NET, and Omnisharp logs are empty, and the Omnisharp icon not showing in the status bar.

Same problem as 3640 I tried uninstalling all extensions other than C#. I tried reinstalling VSCode entirely. I tried some of the fixes from the other task.

The reason I am reopening this issue is that I can replicate the problem even when not interfacing with Unity at all. Which means that the "Resolved-External" tag seems misplaced. Additionally the folder section of the explorer is not empty as another user experienced.

Steps to Reproduce

  1. Launch VS code
  2. Install the C# Extension by Microsoft
  3. Close and reopen VS Code
  4. Open a .cs file
  5. C#, Omnisharp, and .NET logs will all be empty. No Intellisense, and Omnisharp not starting

Expected Behavior

Omnisharp starting, and C# Intellisense working normally

Actual Behavior

Omnisharp not starting, C# Intellisense not working

Logs

Completely Empty

OmniSharp log

Completely Empty

C# log

Completely Empty

Environment information

VSCode version: 1.46.1 C# Extension: 1.22.1

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.201 Commit: b1768b4ae7 Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.201\ Host (useful for support): Version: 3.1.3 Commit: 4a9f85e9f8 .NET Core SDKs installed: 2.1.401 [C:\Program Files\dotnet\sdk] 3.1.201 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |autoimport|steoates|1.5.3| |biosyntax|reageyao|0.0.9| |Bookmarks|alefragnani|11.3.1| |cif|thisperiodictable|0.2.1| |csharp|ms-dotnettools|1.22.1| |gitlens|eamodio|10.2.2| |imagepreview|buzzfrog|0.5.1| |Lua|keyring|0.0.9| |MagicPython|magicstack|1.1.0| |partial-diff|ryu1kn|1.4.1| |prettier-vscode|esbenp|5.1.1| |python|ms-python|2020.6.90262| |python-extension-pack|donjayamanne|1.6.0| |remote-wsl|ms-vscode-remote|0.44.4| |unity-debug|Unity|2.7.5| |vscode-autohotkey|slevesque|0.2.2| |vscode-django|batisteo|0.20.0| |vscode-gutter-preview|kisstkondoros|0.26.2| |vscode-nuget-package-manager|jmrog|1.1.6| |vscode-peacock|johnpapa|3.7.2| |vscodeintellicode|VisualStudioExptTeam|1.2.9| |vsliveshare|ms-vsliveshare|1.0.2377| |vsliveshare-pack|ms-vsliveshare|0.4.0| |xml|DotJoshJohnson|2.5.0|;
JoeRobich commented 4 years ago

Hi @EthanVanderHorn,

I reproduced the issue of OmniSharp not activating when a single .cs file is open. In part it is related to https://github.com/OmniSharp/omnisharp-vscode/pull/1592 because the '*/.cs' is not part of the workspace contains check.

At the moment opening a plain .cs file does not provide enough information to provide intellisense. It has no record of nuget package references, framework references, or project references. This information is all stored in the project file.

We recommend opening a folder that directly or recursively contains the solution or project file your .cs file is a part of.

We will likely revisit the single file experience as top-level statement makes its way into C#.

-Joey

hanhsia commented 3 years ago

I also can't trigger OmniSharp if I open a workspace which contains multiple projects. In this case. C# extension is never loaded. But when i open a specific folder in side the worksapce, it works fine. So does it mean C# extension can't support workspace?

JoeRobich commented 3 years ago

@hanhsia VS Code workspaces are currently not well supported. See https://github.com/OmniSharp/omnisharp-vscode/issues/1889