cuelang.org/go@v0.10.1/internal/golangorgx/gopls/server/command.go (about)

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package server
     6  
     7  import (
     8  	"context"
     9  
    10  	"cuelang.org/go/internal/golangorgx/gopls/protocol"
    11  	"cuelang.org/go/internal/golangorgx/tools/event"
    12  )
    13  
    14  // showMessage causes the client to show a progress or error message.
    15  //
    16  // It reports whether it succeeded. If it fails, it writes an error to
    17  // the server log, so most callers can safely ignore the result.
    18  func showMessage(ctx context.Context, cli protocol.Client, typ protocol.MessageType, message string) bool {
    19  	err := cli.ShowMessage(ctx, &protocol.ShowMessageParams{
    20  		Type:    typ,
    21  		Message: message,
    22  	})
    23  	if err != nil {
    24  		event.Error(ctx, "client.showMessage: %v", err)
    25  		return false
    26  	}
    27  	return true
    28  }