Intellisense does not work at all. It has not worked since I downloaded Visual Studio Code.
Downloaded Unity, Downloaded Visual Studio Code, Installed C# Extension and recommended .NET SDK, Intellisense not working.
Expected underlines, suggestions, etc. All features of Intellisense.
Some suggestions, no descriptions, no underlines. Visual Studio is basically unusable.
VSCode version: 1.38.1
C# Extension: 1.21.3
Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 2.2.402
Commit: c7f2f96116
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Filesdotnet\sdk\2.2.402\
Host (useful for support):
Version: 2.2.7
Commit: b1e29ae826
.NET Core SDKs installed:
2.2.402 [C:\Program Filesdotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.7 [C:\Program Filesdotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Filesdotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Filesdotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
|Extension|Author|Version|
|---|---|---|
|csharp|ms-vscode|1.21.3|;
I am not getting Intellisense or syntax highlighting as well. I have C# extension version 1.21.3, and .NET Core SDK version 3.0.100.
VSCode Info:
Version: 1.38.1 (user setup)
Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0
Date: 2019-09-11T13:35:15.005Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362
@MRosari0 Since you're on windows, you can use a small workaround. You can follow the directions from here: https://github.com/OmniSharp/omnisharp-vscode/issues/3289#issuecomment-534488147
You can confirm its using the new ms build directory by looking at the omnisharp log (with debug on) and looking for this entry:
[dbug]: OmniSharp.MSBuild.ProjectSystem
MSBuild environment:
Mode: VisualStudio
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
MSBuildToolsDirectory64: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\amd64
MSBuildSDKsPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Sdks
CurrentMSBuildConfigurationFile: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe.config
CurrentMSBuildExePath: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
CurrentMSBuildToolsDirectory: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
VisualStudioInstallRootDirectory: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
MSBuildExtensionsPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild
It should be using msbuild from the new build tools you just installed rather than the one shipping with omnisharp.
I think the problem is basically this https://github.com/OmniSharp/omnisharp-vscode/issues/3290
Hopefully fixed for windows with https://github.com/OmniSharp/omnisharp-roslyn/pull/1606
Linux and mac can try installing mono 6 or newer per this comment https://github.com/OmniSharp/omnisharp-vscode/issues/3290#issuecomment-534537270
Edit:
@filipw thanks for the clarification! I've updated my comment to better reflect the facts. My apologies for the initial misinformed linking.
The reason for this workaround is apparently this: #3287 (comment)
The linked comment is not correct. OmniSharp ships with MSBuild 16 since April (https://github.com/OmniSharp/omnisharp-roslyn/pull/1444) - that's why .NET Core 3.0 previews worked with OmniSharp before. It's just MSBuild 16 has assembly version 15.x which is why it shows up in the paths in a misleading way, with 15. There are several other issues that cause certain problems though - especially with .NET Core 3.0 RTM.
If you install VS 2019 or VS 2019 Build Tools (or Mono 6+ on *nix), OmniSharp will automatically pick it up instead of the embedded MSBuild and use that for language services - there should be no need to export any additional variables. It has always worked like that (for all VS versions) and it's the safest bet to resolve any issues.
For the embedded runtime - without VS/VS Build Tools/Mono - at the moment the best workaround would be to try https://github.com/OmniSharp/omnisharp-vscode/issues/3290#issuecomment-536199648 or https://github.com/OmniSharp/omnisharp-vscode/issues/3290#issuecomment-534537270. The latter will always be better though as the support in the built-in MSBuild in VS2019 / Mono will be always better than in the built in instance running on embedded Mono.
Hope this clarifies this a bit.
@MRosari0 Since you're on windows, you can use a small workaround. You can follow the directions from here: #3289 (comment)
You can confirm its using the new ms build directory by looking at the omnisharp log (with debug on) and looking for this entry:[dbug]: OmniSharp.MSBuild.ProjectSystem MSBuild environment: Mode: VisualStudio RunningTests: False RunningInVisualStudio: False MSBuildToolsDirectory32: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin MSBuildToolsDirectory64: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\amd64 MSBuildSDKsPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Sdks CurrentMSBuildConfigurationFile: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe.config CurrentMSBuildExePath: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe CurrentMSBuildToolsDirectory: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin VisualStudioInstallRootDirectory: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools MSBuildExtensionsPath: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuildIt should be using msbuild from the new build tools you just installed rather than the one shipping with omnisharp.
I think the problem is basically this #3290
Hopefully fixed for windows with OmniSharp/omnisharp-roslyn#1606
Linux and mac can try installing mono 6 or newer per this comment #3290 (comment)Edit:
@filipw thanks for the clarification! I've updated my comment to better reflect the facts. My apologies for the initial misinformed linking.
If you install VS 2019 or VS 2019 Build Tools (or Mono 6+ on *nix), OmniSharp will automatically pick it up instead of the embedded MSBuild and use that for language services - there should be no need to export any additional variables. It has always worked like that (for all VS versions) and it's the safest bet to resolve any issues.
I actually have VS Enterprise 2019 installed so it sounds like I don't need to pick up the build tools.
This is what's showing in my OmniSharp Log. I have debugging on but didn't get the output you had referenced. Would these lines work as confirmation?
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Enterprise 2019 16.3.29326.143 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
2: StandAlone 16.0 - "C:\Users\my_username\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.4-beta.7\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Enterprise 2019 16.3.29326.143 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
I followed the tutorial from Microsoft for VS Code with Unity and it seemed to finally do the trick... https://code.visualstudio.com/docs/other/unity
Steps I took:
Hope this helps!
I've run into this before. In my case, it was simply because the project was not added to the solution in the directory root. Appears that OmniSharp looks in there to determine which projects to provide intellisense for.
One thing to be aware of when working with C# scripts in Unity is that you don't want to double click the script from Unity to open it. When this happens, only the file is opened which doesn't pull in the Project references and other information needed to provide intellisense and analysis. It is better to use Assets -> Open C# Project, since that will open the full project in VS Code.
@JAMJAR64 does this still reproduce for you? How did you open the C# file, as @JoeRobich describes?
Bro, i have the answer for you. the solution is super SIMPLE you just have to make sure that you already downloaded these tools :
which you can find them all on VSCode, after installing it, close the VSCode and reopen. That's all of it.
I've been strolling to any possible solutions I could find for the same problems as yours, but the answer is just as away as your right-hand to your mouse.
@paulusuluap Bro, I have installed these tools for ages, but still it won't work in Unity 2020.
Update: I found a workaround on the Unity forum that actually worked:
https://forum.unity.com/threads/intellisense-not-working-for-visual-studio-code.812040/#post-5858986
I have no idea why it helped, because I was already running a blank Unity project and Unity should have set everything up already. But it worked.
Closing out as there was no repro given.
Most helpful comment
One thing to be aware of when working with C# scripts in Unity is that you don't want to double click the script from Unity to open it. When this happens, only the file is opened which doesn't pull in the Project references and other information needed to provide intellisense and analysis. It is better to use Assets -> Open C# Project, since that will open the full project in VS Code.