joshmcode joshmcode - 1 year ago 126
C# Question

Intellisense Stopped Working on Visual Studio Code, OSX

The intellisense on my Visual Studio Code stopped working rather suddenly the other day. I looked all over Stack Overflow for solutions, including looking at these questions:

Visual Studio Code Intellisense Suggestions Dont Pop Up Automatically

Intellisense Does Not Work Visual Studio Code in OSX Yosemite

However, everything is configured properly:

  1. OmniSharp is running

  2. My project.json is configured correctly

  3. Settings were turned on properly in settings.json

  4. There is only one project.json file and Visual Code shows that it is discovering it properly

I tried reinstalling Visual Code and updating the C# extensions app.

What is the problem?

Answer Source

The issue (after hours of looking) is that OmniSharp requires the Mono runtime. I had pointed at the coreclr (1.0.0-rc1-update1, coreclr x64, darwin) the other day because Mono wasn't compatible with SSL-to-Azure connections. To keep things clean, I had just uninstalled the Mono runtime, hoping to just use the coreclr.

The process for this: I first found this Git post: No intellisense on Linux for ASP .NET 5 coreclr x64 1.0.0.-rc1-final. I followed the instructions and showed the OmniSharp output (how to: Command, Shift, p in Visual Studio Code to open prompt, then type output, select Toggle Output and then change the view to OmniSharp using the dropdown). This output, when trying intellisense, showed a lot of errors being generated.

I then searched those errors and found this question/answer Visual Studio Code Designhostmanager Failed. Apparently, I needed to download the Mono runtime, specifically (in my case), Beta5, per the comment from Matt. To do this I ran dnvm install 1.0.0-beta5 in my terminal on OSX and the runtime installed and set Mono as the currently used runtime. Then, I ran dnu restore to make sure all of the proper library references were cleaned up. Finally, Visual Code prompted me for an additional restore, which I ran as well. Here is my final output (please ignore the extra Mono runtimes. I was playing around and wasn't exactly sure what the specific differences were between them):

1.0.0-beta4 mono linux/osx
1.0.0-beta5 mono linux/osx (this is the runtime)
1.0.0-rc1-update1 coreclr x64 darwin
1.0.0-rc1-update1 mono linux/osx
1.0.0-rc1-update2 mono linux/osx default

Finally, I restarted Visual Studio Code and then restarted the OmniSharp service (once again using the Command, Shift, p command and typing OmniSharp and selecting restart.

This worked. Intellisense started working again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download