@@ -24,6 +24,7 @@ type DiagnosticsWriter interface {
2424// clientHandler handles JSON-RPC requests and notifications.
2525type clientHandler struct {
2626 cfg * ClientConfig
27+ hideDiag bool
2728 diagWriter DiagnosticsWriter
2829 diag map [protocol.DocumentURI ][]protocol.Diagnostic
2930 mu sync.Mutex
@@ -50,6 +51,9 @@ func (h *clientHandler) Event(context.Context, *interface{}) error {
5051}
5152
5253func (h * clientHandler ) PublishDiagnostics (ctx context.Context , params * protocol.PublishDiagnosticsParams ) error {
54+ if h .hideDiag {
55+ return nil
56+ }
5357 h .mu .Lock ()
5458 defer h .mu .Unlock ()
5559
@@ -94,6 +98,7 @@ func (h *clientHandler) ApplyEdit(ctx context.Context, params *protocol.ApplyWor
9498type ClientConfig struct {
9599 * config.Server
96100 RootDirectory string // used to compute RootURI in initialization
101+ HideDiag bool // don't write diagnostics to DiagWriter
97102 DiagWriter DiagnosticsWriter // notification handler writes diagnostics here
98103 Workspaces []protocol.WorkspaceFolder // initial workspace folders
99104 Logger * log.Logger
@@ -118,6 +123,7 @@ func (c *Client) init(conn net.Conn, cfg *ClientConfig) error {
118123 stream := jsonrpc2 .NewHeaderStream (conn , conn )
119124 ctx , rpc , server := protocol .NewClient (ctx , stream , & clientHandler {
120125 cfg : cfg ,
126+ hideDiag : cfg .HideDiag ,
121127 diagWriter : cfg .DiagWriter ,
122128 diag : make (map [protocol.DocumentURI ][]protocol.Diagnostic ),
123129 })
0 commit comments