简体   繁体   English

Intellisense停止在Visual Studio Code和OSX上运行

[英]Intellisense Stopped Working on Visual Studio Code, OSX

The intellisense on my Visual Studio Code stopped working rather suddenly the other day. 前几天,Visual Studio Code上的智能提示突然停止工作。 I looked all over Stack Overflow for solutions, including looking at these questions: 我在Stack Overflow各处寻找解决方案,其中包括这些问题:

Visual Studio Code Intellisense Suggestions Dont Pop Up Automatically Visual Studio Code Intellisense建议不会自动弹出

Intellisense Does Not Work Visual Studio Code in OSX Yosemite Intellisense无法在OSX Yosemite中运行Visual Studio代码

However, everything is configured properly: 但是,一切都配置正确:

  1. OmniSharp is running OmniSharp正在运行
  2. My project.json is configured correctly 我的project.json配置正确
  3. Settings were turned on properly in settings.json 在settings.json中正确打开了设置
  4. There is only one project.json file and Visual Code shows that it is discovering it properly 只有一个project.json文件,Visual Code显示它已正确发现它

I tried reinstalling Visual Code and updating the C# extensions app. 我尝试重新安装Visual Code并更新C#扩展应用程序。

What is the problem? 问题是什么?

The issue (after hours of looking) is that OmniSharp requires the Mono runtime. 问题(经过数小时的观察)是OmniSharp需要Mono运行时。 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. 前几天,我指出了coreclr(1.0.0-rc1-update1,coreclr x64,darwin),因为Mono与SSL到Azure的连接不兼容。 To keep things clean, I had just uninstalled the Mono runtime, hoping to just use the coreclr . 为了保持整洁,我刚刚卸载了Mono运行时,希望只使用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 . 过程:我首先发现了这篇Git帖子: Linux上没有针对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). 我按照说明进行了操作,并显示了OmniSharp输出(如何:在Visual Studio Code中打开Command, Shift, p以打开提示,然后键入output ,选择Toggle Output ,然后使用下拉列表将视图更改为OmniSharp)。 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 . 然后,我搜索了这些错误,并找到了这个问题/答案Visual Studio Code Designhostmanager Failed Apparently, I needed to download the Mono runtime, specifically (in my case), Beta5, per the comment from Matt. 显然,根据Matt的评论,我需要下载Mono运行时,特别是(对于我而言)Beta5。 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. 为此,我在OSX的终端上运行了dnvm install 1.0.0-beta5并安装了运行时,并将Mono设置为当前使用的运行时。 Then, I ran dnu restore to make sure all of the proper library references were cleaned up. 然后,我运行dnu restore以确保清理了所有正确的库引用。 Finally, Visual Code prompted me for an additional restore, which I ran as well. 最后,Visual Code提示我进行其他还原,我也运行了该还原。 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): 这是我的最终输出(请忽略额外的Mono运行时。我在玩耍,不确定是否有具体的区别):

1.0.0-beta4 mono linux/osx
1.0.0-beta5 mono linux/osx (this is the runtime) 1.0.0-beta5 mono linux/osx (这是运行时)
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. 最后,我重新启动了Visual Studio Code,然后重新启动了OmniSharp服务(再次使用Command, Shift, p命令并键入OmniSharp然后选择重新启动。

This worked. 这工作了。 Intellisense started working again. Intellisense重新开始工作。

I had a similar issue and saw the following within the OmniSharp logs: 我遇到了类似的问题,并在OmniSharp日志中看到以下内容:

[ERROR:OmniSharp.Startup] The project system 'DotNetProjectSystem' threw exception during initialization.
The type initializer for 'Crypto' threw an exception.

I stumbled across this issue on GitHub, and ran the following commands using the Terminal: 我在GitHub上偶然发现了这个问题 ,并使用Terminal运行了以下命令:

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

After this I restarted OmniSharp using the instructions above and IntelliSense is back. 之后,我按照上述说明重新启动了OmniSharp,然后IntelliSense又回来了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM