尝试使用vim使用新的omnisharp。
我当前的设置是omimharp-vim的vim。 那些直接在项目目录中手动启动omnisharp-server客户端的github页面(因此它可以索引所有的.cs文件),然后尝试使用vim。
问题是我无法启动omnisharp服务器。
按照github页面上的步骤操作后:https://github.com/OmniSharp/omnisharp-server
我收到以下错误(从vim bundle目录运行或只是一个新克隆的xbuilt目录)
HelloMvc>$ mono ~/.vim/bundle/Omnisharp/server/OmniSharp/obj/Debug/OmniSharp.exe -s .
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Nancy.Hosting.Self,
Version=0.22.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'Nancy.Hosting.Self, Version=0.22.2.0, Culture=neutral, PublicKeyToken=null'
at OmniSharp.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly
'Nancy.Hosting.Self, Version=0.22.2.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies.
File name: 'Nancy.Hosting.Self, Version=0.22.2.0, Culture=neutral, PublicKeyToken=null'
at OmniSharp.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
所以看来单声道没有Nancy.Hosting.Self组装?
所以我手动下载了Nancy项目并尝试构建它并得到了这个错误:
/Users/me/seesharp/Nancy/src/Nancy.sln (default targets) ->
(Build target) ->
/Users/me/seesharp/Nancy/src/Nancy.Hosting.Wcf/Nancy.Hosting.Wcf.csproj (default targets) ->
/usr/local/Cellar/mono/3.10.0/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
NancyWcfGenericService.cs(65,31): error CS1061: Type `System.ServiceModel.Web.WebOperationContext'
does not contain a definition for `CreateStreamResponse' and no extension method
`CreateStreamResponse' of type `System.ServiceModel.Web.WebOperationContext' could be found. Are you
missing an assembly reference?
好吧这很奇怪,因为github页面说它正在构建,所以让我们看看代码失败了:
[WebInvoke(UriTemplate = "*", Method = "*")]
public Message HandleRequests(Stream requestBody)
{
var webContext = WebOperationContext.Current;
var nancyRequest =
CreateNancyRequestFromIncomingWebRequest(webContext.IncomingRequest, requestBody, OperationContext.Current);
var nancyContext =
engine.HandleRequest(nancyRequest);
SetNancyResponseToOutgoingWebResponse(webContext.OutgoingResponse, nancyContext.Response);
return webContext.CreateStreamResponse(
stream =>
{
nancyContext.Response.Contents(stream);
nancyContext.Dispose();
},
nancyContext.Response.ContentType ?? string.Empty);
}
位于文件顶部
using System.ServiceModel.Web;
引用也出现在项目.csproj文件中。
所以发生了什么,如果我走错了方向,如果我等待修复omnisharp-vim或youcompleteme插件,我怎么能让omnisharp-server工作呢?此?
编辑: 好吧,在尝试了mvcmusicstore应用程序并加载后,我看到vim说它运行mono的方式是这样的:
mono '/Users/me/.vim/bundle/Omnisharp/server/OmniSharp/bin/Debug/OmniSharp.exe' -p 2000 -s .
但是这给了我以下错误:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at OmniSharp.Solution.CSharpProject.AddReference (IAssemblyReference reference) [0x00000] in <filename unknown>:0
at OmniSharp.Solution.CSharpProject.AddMsCorlib () [0x00000] in <filename unknown>:0
at OmniSharp.Solution.CSharpProject..ctor (ISolution solution, OmniSharp.Logger logger, System.String folderPath) [0x00000] in <filename unknown>:0
at OmniSharp.Solution.CSharpFolder.LoadSolution () [0x00000] in <filename unknown>:0
at OmniSharp.Program.StartServer (System.String solutionPath, System.String clientPathMode, Int32 port, Verbosity verbosity, System.String configLocation) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at OmniSharp.Solution.CSharpProject.AddReference (IAssemblyReference reference) [0x00000] in <filename unknown>:0
at OmniSharp.Solution.CSharpProject.AddMsCorlib () [0x00000] in <filename unknown>:0
at OmniSharp.Solution.CSharpProject..ctor (ISolution solution, OmniSharp.Logger logger, System.String folderPath) [0x00000] in <filename unknown>:0
at OmniSharp.Solution.CSharpFolder.LoadSolution () [0x00000] in <filename unknown>:0
at OmniSharp.Program.StartServer (System.String solutionPath, System.String clientPathMode, Int32 port, Verbosity verbosity, System.String configLocation) [0x00000] in <filename unknown>:0
答案 0 :(得分:0)
事实证明这是omnisharp-vim的一个问题。
下载,构建和运行omnisharp服务器解决方案为我解决了这个问题
编辑:已在omnisharp-vim插件中修复此问题。拉最新和重建,你应该没事。感谢维护者。