From daea76a602fd8e810ce2e2cce5f9eb6aa2d3794e Mon Sep 17 00:00:00 2001 From: David Zager Date: Mon, 29 Jul 2024 16:01:52 -0400 Subject: [PATCH] :bug: .net: handle all progress messages we might see (#669) Signed-off-by: David Zager --- .../dotnet-external-provider/Dockerfile | 2 +- .../dotnet-external-provider/Dockerfile.windows | 2 +- .../pkg/dotnet/service_client.go | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/external-providers/dotnet-external-provider/Dockerfile b/external-providers/dotnet-external-provider/Dockerfile index d983b8d2..02cf1e22 100644 --- a/external-providers/dotnet-external-provider/Dockerfile +++ b/external-providers/dotnet-external-provider/Dockerfile @@ -44,7 +44,7 @@ USER root RUN microdnf -y install dotnet-sdk-7.0 go-toolset \ && microdnf clean all \ && rm -rf /var/cache/yum -RUN dotnet tool install --global csharp-ls +RUN dotnet tool install --global csharp-ls --version 0.11.0 ENV PATH="$PATH:/opt/app-root/.dotnet/tools:/home/go/bin" USER default EXPOSE 3456 diff --git a/external-providers/dotnet-external-provider/Dockerfile.windows b/external-providers/dotnet-external-provider/Dockerfile.windows index cded869d..6022ed46 100644 --- a/external-providers/dotnet-external-provider/Dockerfile.windows +++ b/external-providers/dotnet-external-provider/Dockerfile.windows @@ -16,7 +16,7 @@ RUN go build -o bin/dotnet-external-provider.exe main.go FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 -RUN dotnet tool install --global csharp-ls --version 0.13.0 +RUN dotnet tool install --global csharp-ls --version 0.11.0 # Set the working directory inside the container WORKDIR C:/app diff --git a/external-providers/dotnet-external-provider/pkg/dotnet/service_client.go b/external-providers/dotnet-external-provider/pkg/dotnet/service_client.go index 04bbc581..f2e36810 100644 --- a/external-providers/dotnet-external-provider/pkg/dotnet/service_client.go +++ b/external-providers/dotnet-external-provider/pkg/dotnet/service_client.go @@ -257,15 +257,12 @@ type handler struct { func (h *handler) replyHandler(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error { method := req.Method() h.log.Info("Got request for " + method) - // params, _ := req.Params().MarshalJSON() switch method { case protocol.MethodClientRegisterCapability: err := reply(ctx, nil, nil) - // h.ch <- 1 return err case protocol.MethodWorkspaceConfiguration: err := reply(ctx, nil, nil) - // h.ch <- 2 return err case protocol.MethodWindowShowMessage: var showMessageParams protocol.ShowMessageParams @@ -273,8 +270,10 @@ func (h *handler) replyHandler(ctx context.Context, reply jsonrpc2.Replier, req return reply(ctx, nil, err) } err := reply(ctx, nil, nil) - if strings.HasSuffix(showMessageParams.Message, "project files loaded") || strings.Contains(showMessageParams.Message, "finished loading solution") { - h.ch <- 3 + if strings.HasSuffix(showMessageParams.Message, "project files loaded") || + strings.HasSuffix(showMessageParams.Message, "project file(s) loaded") || + strings.Contains(showMessageParams.Message, "finished loading solution") { + h.ch <- 1 } return err case protocol.MethodProgress: @@ -287,7 +286,9 @@ func (h *handler) replyHandler(ctx context.Context, reply jsonrpc2.Replier, req valueMap, _ := methodProgressParams.Value.(map[string]interface{}) if message, ok := valueMap["message"]; ok { h.log.Info("Extracted message", "message", message) - if strings.Contains(message.(string), "finished loading solution") { + if strings.HasSuffix(message.(string), "project files loaded") || + strings.HasSuffix(message.(string), "project file(s) loaded") || + strings.Contains(message.(string), "finished loading solution") { h.ch <- 3 } } else {