Visual Studio For Mac Intellisense

Try the new assisted IntelliSense experience by downloading our experimental extension for Visual Studio 2017 version 15.7 or higher. Read more Visual Studio IDE for Windows and Mac. With our release of Visual Studio for Mac last month, I’m happy to say that we have begun the work of updating our HTML & CSS editors to match the feature set of Visual Studio on Windows. This is just the start and more work is yet to come – we’re working to re-use the same code for much of these editors.

Active3 years, 8 months ago

I am using Visual Studio Code to develop an ASP.NET 5 application on Mac. The issue I am having is that I don't get any IntelliSense support (e.g. available class methods) beyond simple autocomplete for methods and variables names that I previously typed.

The app targets DNX Core 5.0:

And I have CoreCLR 1.0.0-rc1-update1 installed via DNVM:

$dnvm list

Visual Studio For Mac Intellisense Systems

Active Version Runtime Architecture OperatingSystem Alias

Intellisense

------ ------- ------- ------------ --------------- -----

  • 1.0.0-rc1-update1 coreclr x64 darwin default

I tried the following to resolve the issue, but with no luck:

  • Made sure that a project is selected (fire icon in the bottom right corner)
  • Explicitly turned suggestions in settings.json

Any suggestions will be much appreciated.

Nikolai SamteladzeNikolai SamteladzeVisual Studio For Mac Intellisense
5,8994 gold badges37 silver badges68 bronze badges

1 Answer

In short, the problem was that, while I had Mono installed on my machine, I didn't have DNX Mono. Installing it via DNVM locally (dnvm upgrade -r mono) resolved the issue and now I am having nice IntelliSense support in Visual Studio Code.

Now the long story.

Visual Studio Code uses OmniSharp to provide IntelliSense support. OmniSharp is a set of tools that provides C# code analysis services through a Nancy-based web API that runs on your machine (great posts on it here and here).

I didn't not get any IntelliSense because OmniSharp ran with errors which I could have easily caught if I paid more attention to Visual Studio Code Output window (Cmd+LL on Mac). OmniSharp Log (see below) shows that it tried to use dnx-mono.1.0.0-rc1-update1 runtime and then threw an exception because it was not there.

From what I understand, OmniSharp can't use DNX CoreCLR (because it doesn't support sockets?) and needs DNX Mono to run. There is some discussion on this topic in VS Code GitHub repo here.

Running dnvm upgrade -r mono and restarting Visual Studio Code fixed the issue. My DNVM set up now looks like this:

Please note that you don't have to use DNX Mono for development in order to get IntelliSense to work. You just need to have it installed.

OmniSharp Log

[INFO] Starting OmniSharp at APP_PATH...

Visual Studio For Mac Intellisense

[INFO] Started OmniSharp from '/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/jrieken.vscode-omnisharp/bin/omnisharp' with process id 34893...

[INFORMATION:OmniSharp.Startup] Omnisharp server running using stdio at location APP_PATH on host 34884.

[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Scanning APP_PATH for DNX projects

[INFORMATION:OmniSharp.Dnx.DnxPaths] Using runtime '/Users/nsamteladze/.dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1'.

[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Found project APP_PATH/project.json.

[INFORMATION:OmniSharp.Dnx.DesignTimeHostManager] Using '/Users/nsamteladze/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1' for design time host.

[ERROR:OmniSharp.Startup] The project system 'DnxProjectSystem' threw an exception. System.InvalidOperationException: File name has not been set at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0 at System.Diagnostics.Process.Start () [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start () at OmniSharp.Dnx.DesignTimeHostManager.Start (System.String hostId, System.Action`1 onConnected) [0x00000] in :0 at OmniSharp.Dnx.DnxProjectSystem.Initalize (IConfiguration configuration) [0x00000] in :0 at OmniSharp.Startup.Configure (IApplicationBuilder app, IServiceProvider serviceProvider, ILibraryManager manager, IOmnisharpEnvironment env, ILoggerFactory loggerFactory, ISharedTextWriter writer, IOptions'1 optionsAccessor) [0x00000] in :0

[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] No solution files found in APP_PATH

[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Detecting CSX files in APP_PATH.

Visual Studio Mac Intellisense Shortcut

[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Could not find any CSX files

[INFORMATION:OmniSharp.Startup] Solution has finished loading

Nikolai Samteladze

Mac Visual Studio Code

Nikolai Samteladze
5,8994 gold badges37 silver badges68 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged c#intellisensevisual-studio-codeomnisharp or ask your own question.