Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it ready yet? #5

Closed
mikeTWC1984 opened this issue Aug 8, 2019 · 51 comments
Closed

Is it ready yet? #5

mikeTWC1984 opened this issue Aug 8, 2019 · 51 comments

Comments

@mikeTWC1984
Copy link

mikeTWC1984 commented Aug 8, 2019

Just started to play around. At a glance it doesn't seem to work properly. I see some suggestion from LS, but mainly snippets/key words. I don't see any methods/properties, or stuff from added packages. Example:
Screenshot from 2019-08-07 22-59-18

Does it need mono and solution file (like original omnisharp?)

I'm on linux, using core sdk 2.2, nvim 0.37

@yatli
Copy link
Member

yatli commented Aug 12, 2019

@mikeTWC1984 it'll need at least a .csproj file -- otherwise workspace root cannot be detected.

@mvrozanti
Copy link

I've got .csproj in the same folder and get the same results unfortunately.

@mikeTWC1984
Copy link
Author

On my end neither csproj or solution works. So was just checking if the project is still in the early stage. I tested it only on dotnet core on linux, probably it works better on Windows

@svermeulen
Copy link

svermeulen commented Aug 13, 2019

Yeah I have been unable also to get it working. No errors but incorrect suggestions. This is the only missing piece for me to abandon all other completion plugins completely in favour of coc so excited about this plugin

@yatli
Copy link
Member

yatli commented Aug 13, 2019

could you guys provide the result of :CocInfo? I'll also try to repro it on my side.

@yatli
Copy link
Member

yatli commented Aug 13, 2019

can repro on my side (fvim --wsl).
suspicious log lines:

[Info  - 4:19:05 PM] DotNetPath set to dotnet
[Info  - 4:19:05 PM] Can't use installed Mono because OmniSharp isn't running on it
[Info  - 4:19:05 PM] Located 1 MSBuild instance(s)
            1: StandAlone 16.0 - "/home/yatao/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin"

Omnisharp on Linux should run with mono that shipped with it.

Edit: figured out -- that's irrelevant, and is because I've installed mono to the system.
Removing the system mono did not help.

@yatli
Copy link
Member

yatli commented Aug 13, 2019

Updating to omnisharp 1.34.1 did not help.

@yatli
Copy link
Member

yatli commented Aug 13, 2019

possibly related:

OmniSharp/omnisharp-roslyn#1554

sublimelsp/LSP#661

@yatli
Copy link
Member

yatli commented Aug 13, 2019

hmmmmm -- out of curiosity I tried setting project type to net46 -- and it worked!

@mvrozanti
Copy link

mvrozanti commented Aug 13, 2019

Here's my :CocInfo: http://ix.io/1RzV

I noticed it could not find ~/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin/Microsoft.DotNet.MSBuildSdkResolver.resources.dll , even though I have it under ~/.omnisharp/omnisharp-roslyn/.msbuild/Current/Bin/SdkResolvers

@mvrozanti
Copy link

mvrozanti commented Aug 17, 2019

Tried changing "TargetFramework" property to net46 in .csproj, but still no luck:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
-   <TargetFramework>netcoreapp2.2</TargetFramework>
+   <TargetFramework>net46</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
  </ItemGroup>

</Project>

@yatli
Copy link
Member

yatli commented Aug 17, 2019

@mvrozanti yeah net46 worked for one of my installations but not the others. Still trying to figure this out.

@mvrozanti
Copy link

Can you share your csproj file?

@mvrozanti
Copy link

I also noticed that calling :CocList actions returns an empty list.

@yatli
Copy link
Member

yatli commented Aug 17, 2019

@mvrozanti just created from the bare metal dotnet new console template.

@muratg
Copy link

muratg commented Aug 25, 2019

I would love to see this fixed. Basically this is what's keeping me 1/2 of the time in VSCode. Rest of the time (for JS/TS/..) I'm in coc.nvim.

Is there any workaround?

BTW, net46 as a target would not be an acceptable solution. .NET Core is wher it's at (e.g. ASP.NET Core.)

@muratg
Copy link

muratg commented Aug 25, 2019

FWIW, playing with it a little, I got to this:

Info:
  An assembly specified in the application dependencies manifest (OmniSharp.deps.json) was not found:
    package: 'Microsoft.TestPlatform.TranslationLayer', version: '15.7.2'
    path: 'lib/net451/zh-Hans/Microsoft.TestPlatform.CommunicationUtilities.resources.dll'
Processing native/culture for deps entry [Microsoft.TestPlatform.TranslationLayer, 15.7.2, lib/net451/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll]
  Considering entry [Microsoft.TestPlatform.TranslationLayer/15.7.2/lib/net451/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll], probe dir [], probe fx level:0, entry fx level:0
Detected a resource asset, will query dir/ietf-tag/resource base: /home/mg/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/zh-Hans asset: Microsoft.TestPlatform.CoreUtilities.resources
    Local path query did not exist /home/mg/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll
    Skipping... not found in deps dir '/home/mg/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/'
    Skipping... not found in probe dir ''

This ring any bells?

Edit: Looks like a bunch of /zh-Hant/Microsoft.TestPlatform.* dependencies are missing in the package. Perhaps a dotnet pack issue while building OmniSharp? FWIW, VSCode omnisharp works just fine on the machine (Ubuntu 18.04.)

@yatli
Copy link
Member

yatli commented Aug 28, 2019

@muratg a quick compare of find . in vscode and coc extensions suggests that the two copies have near-identical structure:

○ → diff -p vscode_omnisharp coc_omnisharp
*** vscode_omnisharp    2019-08-28 14:39:06.041669100 +0800
--- coc_omnisharp       2019-08-28 14:39:19.268337600 +0800
***************
*** 8,14 ****
  ./etc/mono/4.5/machine.config
  ./etc/mono/registry
  ./etc/mono/registry/LocalMachine
! ./install.Lock
  ./lib
  ./lib/libMonoPosixHelper.so
  ./lib/libmono-btls-shared.so
--- 8,14 ----
  ./etc/mono/4.5/machine.config
  ./etc/mono/registry
  ./etc/mono/registry/LocalMachine
! ./etc/mono/registry/last-btime
  ./lib
  ./lib/libMonoPosixHelper.so
  ./lib/libmono-btls-shared.so

@yatli
Copy link
Member

yatli commented Aug 28, 2019

updated to 1.34.2, no luck.

@yatli
Copy link
Member

yatli commented Aug 28, 2019

well it happens to work "by chance":

image

The target framework is netcoreapp3.0

@muratg in the success run, there's no error messages like you posted.

@yatli
Copy link
Member

yatli commented Aug 28, 2019

kept trying to restart nvim but it isn't disrupted this way,
until I tried to do something more fancy -- to list available code actions.
It stopped working, and the problem persists after restarting nvim.

@yatli
Copy link
Member

yatli commented Aug 28, 2019

exceptions in the run:

[Error  - 2:49:52 PM] Failed to handle notification textDocument/completion - System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: position
  at Microsoft.CodeAnalysis.Text.SubText.get_Item (System.Int32 position) [0x0000d] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Text.CompositeText.get_Item (System.Int32 position) [0x0001a] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Text.ChangedText.get_Item (System.Int32 position) [0x00000] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter, System.Boolean alwaysExtendEndSpan) [0x0000c] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter) [0x00000] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.Providers.CompletionUtilities.GetCompletionItemSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.CSharpCompletionService.GetDefaultCompletionListSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 caretPosition) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders.GetCompletionsAsync (Microsoft.CodeAnalysis.Document document, System.Int32 caretPosition, Microsoft.CodeAnalysis.Completion.CompletionTrigger trigger, System.Collections.Immutable.ImmutableHashSet`1[T] roles, Microsoft.CodeAnalysis.Options.OptionSet options, System.Threading.CancellationToken cancellationToken) [0x000e4] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at OmniSharp.Roslyn.CSharp.Services.Intellisense.IntellisenseService.Handle (OmniSharp.Models.AutoComplete.AutoCompleteRequest request) [0x001b1] in <11d9b52fe4944c86976a6769aacabf94>:0 
  at OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler.Handle (OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams request, System.Threading.CancellationToken token) [0x000fa] in <085b402712b349999d01d10816709e97>:0 
  at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, OmniSharp.Extensions.Embedded.MediatR.RequestHandlerDelegate`1[TResponse] next) [0x000e1] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  at OmniSharp.Extensions.LanguageServer.Server.LspRequestRouter.RouteRequest (OmniSharp.Extensions.JsonRpc.IHandlerDescriptor descriptor, OmniSharp.Extensions.JsonRpc.Server.Request request) [0x002e2] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
[Info  - 2:49:52 PM] Finished: Routing Request (24) textDocument/completion in 10ms
[Error  - 2:49:52 PM] Request textDocument/completion failed.
  Message: Internal Error - System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: position
  at Microsoft.CodeAnalysis.Text.SubText.get_Item (System.Int32 position) [0x0000d] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Text.CompositeText.get_Item (System.Int32 position) [0x0001a] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Text.ChangedText.get_Item (System.Int32 position) [0x00000] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter, System.Boolean alwaysExtendEndSpan) [0x0000c] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter) [0x00000] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.Providers.CompletionUtilities.GetCompletionItemSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.CSharpCompletionService.GetDefaultCompletionListSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 caretPosition) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders.GetCompletionsAsync (Microsoft.CodeAnalysis.Document document, System.Int32 caretPosition, Microsoft.CodeAnalysis.Completion.CompletionTrigger trigger, System.Collections.Immutable.ImmutableHashSet`1[T] roles, Microsoft.CodeAnalysis.Options.OptionSet options, System.Threading.CancellationToken cancellationToken) [0x000e4] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at OmniSharp.Roslyn.CSharp.Services.Intellisense.IntellisenseService.Handle (OmniSharp.Models.AutoComplete.AutoCompleteRequest request) [0x001b1] in <11d9b52fe4944c86976a6769aacabf94>:0 
  at OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler.Handle (OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams request, System.Threading.CancellationToken token) [0x000fa] in <085b402712b349999d01d10816709e97>:0 
  at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, OmniSharp.Extensions.Embedded.MediatR.RequestHandlerDelegate`1[TResponse] next) [0x000e1] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  at OmniSharp.Extensions.LanguageServer.Server.LspRequestRouter.RouteRequest (OmniSharp.Extensions.JsonRpc.IHandlerDescriptor descriptor, OmniSharp.Extensions.JsonRpc.Server.Request request) [0x002e2] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  Code: -32602 

@yatli
Copy link
Member

yatli commented Aug 28, 2019

in the following run, it doesn't work from the beginning.

no exceptions in this run.

failures:

[Info  - 2:51:26 PM] FAILURE: Could not locate '/home/yatao/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll'.
[Info  - 2:51:26 PM] Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=3.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[Info  - 2:51:26 PM] FAILURE: Could not locate '/home/yatao/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin/Microsoft.CodeAnalysis.VisualBasic.Features.dll'.

@yatli
Copy link
Member

yatli commented Aug 28, 2019

next run, tried to edit the file before lsp initializes.

[Info  - 2:53:05 PM] Starting: Routing Request (9) textDocument/completion
[Info  - 2:53:05 PM] Converting params for Request (9) textDocument/completion to OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams
[Error  - 2:53:05 PM] Failed to handle notification textDocument/completion - System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at Microsoft.CodeAnalysis.Text.StringText.get_Item (System.Int32 position) [0x00000] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter, System.Boolean alwaysExtendEndSpan) [0x0000c] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter) [0x00000] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.Providers.CompletionUtilities.GetCompletionItemSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.CSharpCompletionService.GetDefaultCompletionListSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 caretPosition) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders.GetCompletionsAsync (Microsoft.CodeAnalysis.Document document, System.Int32 caretPosition, Microsoft.CodeAnalysis.Completion.CompletionTrigger trigger, System.Collections.Immutable.ImmutableHashSet`1[T] roles, Microsoft.CodeAnalysis.Options.OptionSet options, System.Threading.CancellationToken cancellationToken) [0x000e4] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at OmniSharp.Roslyn.CSharp.Services.Intellisense.IntellisenseService.Handle (OmniSharp.Models.AutoComplete.AutoCompleteRequest request) [0x001b1] in <11d9b52fe4944c86976a6769aacabf94>:0 
  at OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler.Handle (OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams request, System.Threading.CancellationToken token) [0x000fa] in <085b402712b349999d01d10816709e97>:0 
  at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, OmniSharp.Extensions.Embedded.MediatR.RequestHandlerDelegate`1[TResponse] next) [0x000e1] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  at OmniSharp.Extensions.LanguageServer.Server.LspRequestRouter.RouteRequest (OmniSharp.Extensions.JsonRpc.IHandlerDescriptor descriptor, OmniSharp.Extensions.JsonRpc.Server.Request request) [0x002e2] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
[Info  - 2:53:05 PM] Finished: Routing Request (9) textDocument/completion in 41ms
[Error  - 2:53:05 PM] Request textDocument/completion failed.
  Message: Internal Error - System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at Microsoft.CodeAnalysis.Text.StringText.get_Item (System.Int32 position) [0x00000] in <f5f011650aeb475585a19a7df1b103c3>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter, System.Boolean alwaysExtendEndSpan) [0x0000c] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.Completion.CommonCompletionUtilities.GetWordSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position, System.Func`2[T,TResult] isWordStartCharacter, System.Func`2[T,TResult] isWordCharacter) [0x00000] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.Providers.CompletionUtilities.GetCompletionItemSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 position) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.CSharp.Completion.CSharpCompletionService.GetDefaultCompletionListSpan (Microsoft.CodeAnalysis.Text.SourceText text, System.Int32 caretPosition) [0x00000] in <0693814b6ac64c208b1b9358bfebe2f3>:0 
  at Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders.GetCompletionsAsync (Microsoft.CodeAnalysis.Document document, System.Int32 caretPosition, Microsoft.CodeAnalysis.Completion.CompletionTrigger trigger, System.Collections.Immutable.ImmutableHashSet`1[T] roles, Microsoft.CodeAnalysis.Options.OptionSet options, System.Threading.CancellationToken cancellationToken) [0x000e4] in <63d059b5e4394d8982428dafc1fdd876>:0 
  at OmniSharp.Roslyn.CSharp.Services.Intellisense.IntellisenseService.Handle (OmniSharp.Models.AutoComplete.AutoCompleteRequest request) [0x001b1] in <11d9b52fe4944c86976a6769aacabf94>:0 
  at OmniSharp.LanguageServerProtocol.Handlers.CompletionHandler.Handle (OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams request, System.Threading.CancellationToken token) [0x000fa] in <085b402712b349999d01d10816709e97>:0 
  at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, OmniSharp.Extensions.Embedded.MediatR.RequestHandlerDelegate`1[TResponse] next) [0x000e1] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  at OmniSharp.Extensions.LanguageServer.Server.LspRequestRouter.RouteRequest (OmniSharp.Extensions.JsonRpc.IHandlerDescriptor descriptor, OmniSharp.Extensions.JsonRpc.Server.Request request) [0x002e2] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  Code: -32602 

@yatli
Copy link
Member

yatli commented Aug 28, 2019

next run: success.
once nvim loads, quickly navigate to the body of Main, insert Console, do not exit insert mode.
wait for lsp to start.
type '.', and the completion entries are received.

image

note, the failure are present even in a successful run:

[Info  - 2:54:09 PM] FAILURE: Could not locate '/home/yatao/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll'.
[Info  - 2:54:09 PM] Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=3.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[Info  - 2:54:09 PM] FAILURE: Could not locate '/home/yatao/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin/Microsoft.CodeAnalysis.VisualBasic.Features.dll'.
[Info  - 2:54:10 PM] FAILURE: Could not locate '/home/yatao/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin/Microsoft.Build.resources.dll'.
[Info  - 2:54:12 PM] Attempting to resolve 'Microsoft.Build.Tasks.Core.resources, Version=15.1.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a'
[Info  - 2:54:12 PM] FAILURE: Could not locate '/home/yatao/.config/coc/extensions/node_modules/coc-omnisharp/omnisharp/omnisharp/.msbuild/Current/Bin/Microsoft.Build.Tasks.Core.resources.dll'.

so perhaps they are irrelevant.

@yatli
Copy link
Member

yatli commented Aug 28, 2019

in the following run, captured another kind of exception:

[Info  - 2:57:42 PM] Starting: Routing Request (1) textDocument/documentSymbol
[Info  - 2:57:42 PM] Converting params for Request (1) textDocument/documentSymbol to OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolParams
[Error  - 2:57:42 PM] Failed to handle notification textDocument/documentSymbol - System.NullReferenceException: Object reference not set to an instance of an object
  at OmniSharp.LanguageServerProtocol.Handlers.DocumentSymbolHandler.Handle (OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolParams request, System.Threading.CancellationToken token) [0x00096] in <085b402712b349999d01d10816709e97>:0 
  at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, OmniSharp.Extensions.Embedded.MediatR.RequestHandlerDelegate`1[TResponse] next) [0x000e1] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  at OmniSharp.Extensions.LanguageServer.Server.LspRequestRouter.RouteRequest (OmniSharp.Extensions.JsonRpc.IHandlerDescriptor descriptor, OmniSharp.Extensions.JsonRpc.Server.Request request) [0x002e2] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
[Info  - 2:57:42 PM] Finished: Routing Request (1) textDocument/documentSymbol in 23ms
[Error  - 2:57:42 PM] Request textDocument/documentSymbol failed.
  Message: Internal Error - System.NullReferenceException: Object reference not set to an instance of an object
  at OmniSharp.LanguageServerProtocol.Handlers.DocumentSymbolHandler.Handle (OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolParams request, System.Threading.CancellationToken token) [0x00096] in <085b402712b349999d01d10816709e97>:0 
  at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2[TRequest,TResponse].Handle (TRequest request, System.Threading.CancellationToken cancellationToken, OmniSharp.Extensions.Embedded.MediatR.RequestHandlerDelegate`1[TResponse] next) [0x000e1] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  at OmniSharp.Extensions.LanguageServer.Server.LspRequestRouter.RouteRequest (OmniSharp.Extensions.JsonRpc.IHandlerDescriptor descriptor, OmniSharp.Extensions.JsonRpc.Server.Request request) [0x002e2] in <cdcdd2bceac34772b5fb2962192e6b77>:0 
  Code: -32602 

@muratg
Copy link

muratg commented Aug 28, 2019

@yatli Thanks for the investigation! To replicate your case (make it work even for a little bit "by chance"), I created a new Console app. Now I'm getting the following whenever I try to do a code complete:

source OmniSharp timeout after 2000ms

@muratg
Copy link

muratg commented Aug 28, 2019

Would it make sense to add a command to restart OmniSharp? Kinda like tsserver does.

@mikeTWC1984
Copy link
Author

Interesting, I used omnisharp-vim plugin sometime ago, and it worked with mono and solution file, but now it gives me same 2000ms error

@yatli
Copy link
Member

yatli commented Aug 29, 2019

@muratg try :CocRestart -- blast everything and start from scratch :)

@muratg
Copy link

muratg commented Aug 29, 2019

Just tried it, still no luck. All I get from code completion is random garbage.

@yatli
Copy link
Member

yatli commented Aug 29, 2019

the timeout constraint can be relaxed in :CocConfig to 5000ms at most

@mikeTWC1984
Copy link
Author

Looks like there is a dependency on coc-utils extension. After installing it omnisharp is working, at least on my end (ubuntu/.net core)

@muratg
Copy link

muratg commented Sep 17, 2019

Thanks @mikeTWC1984. Unfortunately, did not work for me. Same thing as before (timeout). Also Ubuntu (18.04) and .NET Core 2.x. Do you remember installing anything else, by any chance?

edit: @yatli If you have some time, could you try to see if installing coc-utils fixes this for you as well? If so, it'll be clear that something on my end is broken.

edit2: Just saw that @yatli had a bunch of check-ins, so I uninstalled and reinstalled coc-omnisharp, still without success.

@mikeTWC1984
Copy link
Author

Do you have vim-polyglot plugin installed? Also did you enable omnisharp extension (like when you do CocList extension, do you see * or + in before omnisharp). I also have mono installed, it was needed for original omnisharp

@muratg
Copy link

muratg commented Sep 17, 2019

Thanks @mikeTWC1984! Yep, coc-omnisharp is enabled (* next to it). Installed vim-polyglot, but didn't change anything.

Mono seems to make it work better (I wasn't expecting this, because VSCode's version of OmniSharp works without Mono, I assume it uses .NET Core.)

So I get completions now, but I still get timeouts each time.

Also, I don't see the method signature below (like I see when I use TSServer.) Not sure if this is by-design.

Also, I don't see diagnostics either. (if a line is wrong, it doesn't tell me.)

@mikeTWC1984
Copy link
Author

I don't see signatures neither in vim or vscode (I would love to though), probably this might be configured. I don't see timeout errors. I'm using nvim 0.4.

@mikeTWC1984
Copy link
Author

Although there is still some issues with error highlighting - it's highlighting correct lines, and not highlighting obvious errors

@muratg
Copy link

muratg commented Sep 17, 2019

👍 Yeah, I may have high expectations after experiencing TSServer. It's basically on par with VSCode. Hopefully this will get there some day too!

(BTW, in VSCode, ctrl-space pops up a window showing signatures for me.)

@yatli
Copy link
Member

yatli commented Sep 17, 2019

The coc-utils package is not a coc extension but a bunch of utilities. So if you update coc-omnisharp to the latest it should pull in the latest Omnisharp which should be working.

@yatli
Copy link
Member

yatli commented Sep 17, 2019

btw if you haven't configured the notification panel, it could appear that the extension is not working, while it's downloading the server.

@muratg
Copy link

muratg commented Sep 17, 2019

@yatli Yep, after seeing your commits, I uninstalled and reinstalled coc-omnisharp -- still didn't work.

Adding Mono made it work better (I get completions fine now.) Though still get timeouts even if it works.

Not sure why the dependency on Mono is, though. VSCode uses omnisharp too (AFAIK) and it works fine without Mono on the machine.

So currently my problems are:

  1. Not seeing method signatures (like I do for TSServer)
  2. Diagnostics not working well (I don't see if I make a syntax error for example.)
  3. Still see timeout messages for each successful completion.

@yatli
Copy link
Member

yatli commented Sep 17, 2019

@muratg unfortunately I also notice that linting is absent for the latest release of Omnisharp.
Omnisharp release contains necessary mono runtime to get it running, and it probably won't use the system-wide mono :) So I would re-interpret your comment as, you've run it twice, one with no completion and the latter one better :)

@muratg
Copy link

muratg commented Sep 17, 2019

@yatli I think you're right. Mono is probably a red herring. (Because it didn't work after I typed that comment! Now it semi-works again.)

So all 3 issues above stay issues for me.

@yatli
Copy link
Member

yatli commented Sep 17, 2019

A bit of explanation of non-parity with VSCode:

In the vscode extension, it connects to the omnisharp server with a custom protocol (not lsp), and there's a lot of code between O# and VSCode, serving as middleware and enhancing the functionalities here and there.

The language server feature of O# started much later in the development, and recently has undergone huge refactoring to leverage csharp-language-server.

So currently we've got two options, one is to wait for upstream O# lsp improvements, and the other is to start porting the vscode extension middlewares over. The latter would require a lot more work, and would only be possible if we can team up to do it.

edit: the latter option is actually practiced and proven to work -- see coc-tsserver and coc-python -- @chemzqm has done amazing work over there.

@muratg
Copy link

muratg commented Sep 17, 2019

@yatli Thanks a lot for the details, I didn't know VSCode/OmniSharp connection was still custom!

Makes sense now. I like both options, but former appears to be more realistic at this point.

BTW, are you still getting timeouts as well?

@artkpv
Copy link

artkpv commented Mar 31, 2020

Thanks for this work. So I guess now it is better to use https://github.com/OmniSharp/Omnisharp-vim as it has more features (like go to definition, enhanced syntax highlighting, refactoring, other). 😞 C# development on VIM is a frustration to setup environment. Coc.nvim is really great but it seems MS does not want to contribute to plugins (deoplete, coc.nvim, other) and pushes its plugin (O#-vim).

@razzmatazz
Copy link

razzmatazz commented May 17, 2020

I believe some of the problems listed here (especially the sync/invalid completion list at point) were resolved with:

Not released yet, though.

I have also added support for (to be merged by maintainers):

@yatli
Copy link
Member

yatli commented May 17, 2020

Whoa, thank you @razzmatazz , these PRs are super cool!

@mikeTWC1984
Copy link
Author

I can confirm auto-completion works good out of the box now. It also able to discover class files as you add them.
Still:

  • Error/Warning highlighting doesn't work, unless I'm missing some extra config.
  • If you add packages (dotnet add package / restore) it can't discover new assemblies until you restart neovim (not a huge deal though).

@yatli
Copy link
Member

yatli commented Nov 20, 2020

Should be mostly ready now... :)

@yatli yatli closed this as completed Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants