IntelliSense在Mac上的Visual Studio Code中不起作用 [英] IntelliSense doesn't work in Visual Studio Code on Mac

查看:293
本文介绍了IntelliSense在Mac上的Visual Studio Code中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio Code在Mac上开发ASP.NET 5应用程序.我遇到的问题是我没有得到任何 IntelliSense 支持(例如可用的类)方法),而不是我之前键入的方法和变量名称的简单自动完成功能.

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.

该应用程序针对DNX Core 5.0:

The app targets DNX Core 5.0:

"frameworks": {
    "dnxcore50": { }
},

我通过DNVM安装了CoreCLR 1.0.0-rc1-update1:​​

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

$ dnvm列表

$dnvm list

活动版本运行时体系结构操作系统别名

Active Version Runtime Architecture OperatingSystem Alias

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

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

  • 1.0.0-rc1-update1 coreclr x64 darwin默认值

我尝试了以下方法来解决此问题,但没有运气:

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

  • 确保已选择一个项目(右下角的消防图标)
  • settings.json

{
    "editor.quickSuggestions": true`
}

任何建议将不胜感激.

推荐答案

简而言之,问题在于,虽然我在计算机上安装了Mono,但没有DNX Mono.通过DNVM本地安装(dnvm upgrade -r mono)解决了该问题,现在我在Visual Studio Code中获得了很好的IntelliSense支持.

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.

长话短说.

Visual Studio Code使用 OmniSharp 提供IntelliSense支持. OmniSharp是一套工具,可通过在您的计算机上运行的基于Nancy的Web API提供C#代码分析服务(其上的精美文章此处

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).

我没有得到任何IntelliSense,因为OmniSharp运行时出现错误,如果我更加关注Visual Studio Code Output窗口(在Mac上为Cmd+L L),我很容易捕获到错误. OmniSharp日志(如下所示)显示它尝试使用dnx-mono.1.0.0-rc1-update1运行时,然后抛出异常,因为它不存在.

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+L L 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.

据我了解,OmniSharp无法使用DNX CoreCLR(因为它没有(不支持套接字?),并且需要DNX Mono才能运行.在 VS Code GitHub存储库此处中对此主题进行了一些讨论.

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.

运行dnvm upgrade -r mono并重新启动Visual Studio Code可解决此问题.我的DNVM设置现在看起来像这样:

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

请注意,您不必使用DNX Mono进行开发即可使IntelliSense正常工作.您只需要安装它即可.

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日志

[INFO]从APP_PATH启动OmniSharp ...

[INFO] Starting OmniSharp at APP_PATH...

[INFO]从'/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/jrieken.vscode-omnisharp/bin/omnisharp'启动OmniSharp,进程ID为34893 ...

[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服务器在主机34884上的位置APP_PATH上使用stdio运行.

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

[INFORMATION:OmniSharp.Dnx.DnxProjectSystem]扫描APP_PATH以查找DNX项目

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

[INFORMATION:OmniSharp.Dnx.DnxPaths]使用运行时'/Users/nsamteladze/.dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1'.

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

[INFORMATION:OmniSharp.Dnx.DnxProjectSystem]找到了项目APP_PATH/project.json.

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

[INFORMATION:OmniSharp.Dnx.DesignTimeHostManager]使用'/Users/nsamteladze/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1'作为设计时间主机.

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

[ERROR:OmniSharp.Startup]项目系统'DnxProjectSystem'引发了异常. System.InvalidOperationException:文件名尚未设置 在System.Diagnostics.Process.Start_common(System.Diagnostics.ProcessStartInfo startInfo,System.Diagnostics.Process进程)中:[0x00000]在:0中 在:0的System.Diagnostics.Process.Start()[0x00000]中 在(包装器远程调用检查)System.Diagnostics.Process:Start() 在OmniSharp.Dnx.DesignTimeHostManager.Start(System.String hostId,System.Action`1 onConnected)中的[0x00000]在:0中 在OmniSharp.Dnx.DnxProjectSystem.Initalize(IConfiguration配置)[0x00000]中的位置:: 0 在OmniSharp.Startup.Configure(IApplicationBuilder应用程序,IServiceProvider serviceProvider,ILibraryManager管理器,IOmnisharpEnvironment env,ILoggerFactory loggerFactory,ISharedTextWriter作家,IOptions'1 optionsAccessor)中:0

[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]在APP_PATH中找不到解决方案文件

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

[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem]正在检测APP_PATH中的CSX文件.

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

[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem]找不到任何CSX文件

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

[INFORMATION:OmniSharp.Startup]解决方案已加载完成

[INFORMATION:OmniSharp.Startup] Solution has finished loading

这篇关于IntelliSense在Mac上的Visual Studio Code中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆