[英]OmniSharp not loaded in VSCode for global.json folder (but works OK for project.json folders)
I am running Visual Studio Code 1.4.0, .NET Core 1.0 and .NET Core SDK Preview 2. Tested on Windows 10 x64 and Ubuntu 16.04 x64, and observed the same problem. 我正在运行Visual Studio Code 1.4.0,.NET Core 1.0和.NET Core SDK Preview2。在Windows 10 x64和Ubuntu 16.04 x64上进行了测试,并观察到相同的问题。
In the simplest example, my folder structure looks like this: 在最简单的示例中,我的文件夹结构如下所示:
- Repo\
|
+-- global.json
|
+-- LibOne\
| |
| +-- project.json
| +-- ClassOne.cs
|
+-- LibOne.Tests\
|
+-- project.json
+-- ClassOneTests.cs
LibOne
is a class library LibOne
是一个类库 LibOne.Tests
contains xUnit tests for LibOne
LibOne.Tests
包含的xUnit测试LibOne
LibOne.Tests
specifies LibOne
in its dependencies. LibOne.Tests
在其依赖LibOne.Tests
指定LibOne
。 The problem is with IntelliSense. 问题出在智能感知上。 When I open the
Repo
folder in VS Code, the IntelliSense does not work. 当我在VS Code中打开
Repo
文件夹时,IntelliSense无法正常工作。 However, if I open either LibOne
or LibOne.Tests
folder, everything works fine. 但是,如果我打开
LibOne
或LibOne.Tests
文件夹,则一切正常。
The difference that I noticed is that when I open the Repo
folder, I have no logs of OmniSharp (in VS Code, View -> Output -> OmniSharp Log). 我注意到的区别是,当我打开
Repo
文件夹时,没有OmniSharp的日志(在VS Code中,查看->输出-> OmniSharp日志)。 Whereas with project folders, I can see the logs of how OmniSharp is loaded, how it looks for projects, etc. It looks like OmniSharp is somehow not triggered or not associated with folders containing global.json
, and is only loaded when one opens a folder that contains project.json
. 鉴于使用项目文件夹,我可以看到OmniSharp的加载方式日志,查找项目的方式等。看起来OmniSharp某种程度上未触发或未与包含
global.json
文件夹相关联,并且仅当打开一个文件夹时才加载包含project.json
文件夹。
I would appreciate any ideas about what could be wrong here. 对于在这里可能出什么问题的任何想法,我将不胜感激。
I should have read the documentation better. 我应该更好地阅读文档。 Here is what I was missing: https://code.visualstudio.com/docs/editor/codebasics#_opening-a-project
这是我所缺少的: https : //code.visualstudio.com/docs/editor/codebasics#_opening-a-project
In VS Code, when a folder is opened that contains multiple projects, only one project is active at a time (and none is active initially). 在VS Code中,打开一个包含多个项目的文件夹时,一次仅一个项目处于活动状态(最初没有一个项目处于活动状态)。 Project selector is located in the right bottom corner in the status bar.
项目选择器位于状态栏的右下角。
What is still missing from the documentation, is that the IntelliSense will only work for the active project . 文档中仍然缺少的是IntelliSense仅适用于活动项目 。 Not sure whether it is VSCode or OmniSharp limitation.
不确定是VSCode还是OmniSharp限制。 Once I selected an active project, the IntelliSense for that project started to work.
选择活动项目后,该项目的IntelliSense便开始工作。
Not convenient, but better than nothing. 不方便,但总比没有好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.