vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Intellisense does not work unless I open the project in visual studio and then vscode

Open chris-schmitz opened this issue 6 years ago • 8 comments

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.201/

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  3.1.200 [/usr/local/share/dotnet/sdk]
  3.1.201 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.17 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

VS Code version: 1.42.1 (have not updated b/c of a bug with another extension) C# Extension version: 1.21.17 (have not updated because of this intellisense issue)

Steps to reproduce

Open a unity project in vscode without opening it in visual studio first.

Expected behavior

Intellisense working

Actual behavior

Intellisense doesn't work

The way I was able to get intellisense to work

If I open the project in Visual Studio and then switch back to vscode intellisense starts working.

I'm assuming that it's because of the extra files generated

Screen Shot 2020-04-20 at 8 24 08 PM

I'm assuming one or more of these files are needed to make intellisense work in vscode.

Screen Shot 2020-04-20 at 8 32 00 PM

Also, I am ultra ultra new to c# and unity development (I'm working through tutorials now), but I am experienced in other languages and tools. I say that b/c I may not be providing all of the info needed, but if you point out what I'm missing I can def post it.

chris-schmitz avatar Apr 21 '20 01:04 chris-schmitz

@chris-schmitz Sorry you are running into issues. Can you please share the OmniSharp Log Output from a session when you are in the broken state? It may provide the information we need to work out what may be going on. Thanks

JoeRobich avatar Apr 21 '20 16:04 JoeRobich

@chris-schmitz We have seen other recent Unity issues with their Visual Studio Code Editor 1.1.4 package. See this thread where they suggest downgrading to version 1.1.3 - https://forum.unity.com/threads/visual-studio-code-editor-1-1-4-error-the-referenced-project-does-not-exist.806628/ . Please let me know if that resolves the issue you are seeing.

JoeRobich avatar Apr 24 '20 17:04 JoeRobich

Hey thanks for the reply (sorry I'm late seeing it).

Here's my omnisharp log for a project I already opened in visual studio first and then vscode (intellisense working):

Log from project where intellisense DOES work.txt

Log from project where intellisense doesn't work.txt

Also, it's worth noting that in the project where intellisense doesn't work only csproj file created is the Assembly one:

Screen Shot 2020-04-24 at 10 41 58 PM

Let me know if there's anything else I can provide!

chris-schmitz avatar Apr 25 '20 03:04 chris-schmitz

@chris-schmitz try what Joe said. Log indicates it's the same issue.

After upgrading/downgrading package in Unity, try "Assets -> Reimport All" to make sure unity recreates fresh .csproj files that don't have those missing references.

SirIntruder avatar Apr 25 '20 13:04 SirIntruder

Ok cool. I'll give that a try on a fresh project today and see what happens.

chris-schmitz avatar Apr 27 '20 14:04 chris-schmitz

@chris-schmitz Did you have any luck?

JoeRobich avatar Apr 28 '20 20:04 JoeRobich

I had a very similar log. I was able to solve my problem by updating visual studio code editor in the package manager to version 1.2.0. Aftward I did the "Asset -> Reimport All".

RobertAron avatar Apr 29 '20 02:04 RobertAron

I can't get Intellisense working either in VSCode and Unity 2020 either. For instance, no references are shown for methods and properties. Fun fact: Once I save a file, I can see them. But only within that single file. Intellisense does not work cross-file anymore, as it does in Unity 2018 with the very same VSCode configuration. What can I do to fix this? I am using Unity's VSCode package 1.2.1 (most recent version).

derwaldgeist avatar May 23 '20 13:05 derwaldgeist