Skip to content

Commit

Permalink
🐛 .net: handle all progress messages we might see
Browse files Browse the repository at this point in the history
Signed-off-by: David Zager <[email protected]>
  • Loading branch information
djzager committed Jul 23, 2024
1 parent a24f7ea commit 04e7bd7
Showing 1 changed file with 7 additions and 6 deletions.
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 04e7bd7

Please sign in to comment.