Skip to content

Commit

Permalink
🐛 .net: handle all progress messages we might see (#669)
Browse files Browse the repository at this point in the history
Signed-off-by: David Zager <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>
  • Loading branch information
djzager authored and web-flow committed Jul 29, 2024
1 parent 9b7f589 commit 28008c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion external-providers/dotnet-external-provider/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,23 @@ 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
if err := json.Unmarshal(req.Params(), &showMessageParams); err != nil {
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:
Expand All @@ -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 {
Expand Down

0 comments on commit 28008c9

Please sign in to comment.