OmniSharp/omnisharp-roslyn

Missing Cake Response handlers in V1.37.1

THeivers opened this issue · 4 comments

Seems version 1.37.1 broke some actions in Cake scripts, such as "/completion". Trying a completion action returns this in debug:
[dbug]: OmniSharp.Stdio.Host ************ Response ************ { "Request_seq": 19, "Command": "/completion", "Running": true, "Success": false, "Message": "\"System.NotSupportedException: Cake does not support /completion\\r\\n at OmniSharp.Endpoint.EndpointHandler2.d__20.MoveNext() in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 233\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at OmniSharp.Endpoint.EndpointHandler2.<Process>d__16.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 131\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at OmniSharp.Stdio.Host.<HandleRequest>d__13.MoveNext() in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Stdio\\\\Host.cs:line 215\"", "Body": null, "Seq": 704, "Type": "response" }

Seems like versions below 1.37.1 seem to be unaffected.

After some local debugging, it seems like all it needs is two more CakeRequestHandlers that deal with the specific requests, and reroute them to the C# handlers like so:

[OmniSharpHandler(OmniSharpEndpoints.Completion, Constants.LanguageNames.Cake), Shared]
    public class CompletionHandler : CakeRequestHandler<CompletionRequest, CompletionResponse>
    {
        [ImportingConstructor]
        public CompletionHandler(OmniSharpWorkspace workspace)
            : base(workspace)
        {
        }
    }

    [OmniSharpHandler(OmniSharpEndpoints.CompletionResolve, Constants.LanguageNames.Cake), Shared]
    public class CompletionResolveHandler : CakeRequestHandler<CompletionResolveRequest, CompletionResolveResponse>
    {
        [ImportingConstructor]
        public CompletionResolveHandler(OmniSharpWorkspace workspace)
            : base(workspace)
        {
        }
    }

But I'm not that familiar with the code base, it's likely some other commands were broken too.

Thanks! I'll fix this asap. Seems like I forgot to take the new Completion Service into use in Cake also. This is now the default in VSCode, making Completion not working for Cake files.

there are new endpoints /completion and /completion/resolve that replaced the old /autocomplete
Additionally, there is a new endpoint /quickinfo which is also in use in VS Code already for tool tips https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Abstractions/OmniSharpEndpoints.cs#L48

@filipw thanks! I'll add overloads for Cake for all of those then.

Adds Completion in #1944
Adds QuickInfo in #1945