omnisharp-node-client icon indicating copy to clipboard operation
omnisharp-node-client copied to clipboard

Using language server protocal requires preliminary `dotnet restore` on local project

Open mickaelistria opened this issue 9 years ago • 5 comments

I'm connecting a Java client to omnisharp-node-client Language Server implementation. However, I don't manage to get completion or other output from it, whereas the same requests work with VSCode's Language Server implementation for CSS and JSON.

I always get something like (OUT is sent by my client to OmniSharp LS; IN is set by OmniSharp LS to my client:

OUT: 2.0
{"id":"2","method":"textDocument/completion","params":{"textDocument":{"uri":"file:/home/mistria/git/3dLocalizer/test.cs"},"uri":"file:/home/mistria/git/3dLocalizer/test.cs","position":{"line":6,"character":16}},"jsonrpc":"2.0"}
IN: 2.0
{"jsonrpc":"2.0","method":"telemetry/event","params":{"clientId":"client1","command":"/autocomplete","request":{"FileName":"/home/mistria/git/3dLocalizer/test.cs","Column":16,"Line":6,"WantDocumentationForEveryCompletionResult":true,"WantKind":true,"WantImportableTypes":true,"WantMethodHeader":true,"WantReturnType":true,"WantSnippet":false,"WordToComplete":""},"silent":false,"sequence":"__request6","time":"2016-07-21T13:45:07.902Z"}}
IN: 2.0
{"jsonrpc":"2.0","method":"telemetry/event","params":{"command":"/autocomplete","response":[],"clientId":"client1","request":{"FileName":"/home/mistria/git/3dLocalizer/test.cs","Column":16,"Line":6,"WantDocumentationForEveryCompletionResult":true,"WantKind":true,"WantImportableTypes":true,"WantMethodHeader":true,"WantReturnType":true,"WantSnippet":false,"WordToComplete":""},"sequence":"__request6","time":"2016-07-21T13:45:07.941Z","silent":false,"failed":false,"responseTime":39}}
IN: 2.0
{"jsonrpc":"2.0","id":"2","result":{"isIncomplete":false,"items":[]}}
IN: 2.0
{"jsonrpc":"2.0","method":"telemetry/event","params":{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Middleware.LoggingMiddleware","Message":"/autocomplete: 200 37ms"},"Seq":18,"Type":"event"}}

The code I'm trying to complete is

using System;
public class HelloWorld
{
    public static void hello()
    {
        Console.WriteLine("Hello world !");
        Console.ReadLine();
    }
}

just before ReadLine(), so I was expecting all fields is Console to be returned.

mickaelistria avatar Jul 21 '16 13:07 mickaelistria

Is the project restored? I wonder if it's missing dependencies and just not able to offer any completions.

What about diagnostics, are those getting reported?

david-driscoll avatar Jul 21 '16 14:07 david-driscoll

I have to do dotnet restore before connecting to the language-server? I didn't do it, as I expect the language server to take care of all such language-specific stuff.

mickaelistria avatar Jul 21 '16 14:07 mickaelistria

We have a known issue in the language server where it sometimes doesn't restore like it should... that is something I need to tackle.

david-driscoll avatar Jul 21 '16 14:07 david-driscoll

Ok, thanks for the hint, I'll try to restore first. Is the issue you mention already reported on another GitHub issue I could follow?

mickaelistria avatar Jul 21 '16 14:07 mickaelistria

As you advised, I tried a dotnet restore and it works. Should I close the issue then or do we keep it alive to track the issue regarding running restore from the language server?

mickaelistria avatar Jul 21 '16 14:07 mickaelistria