Skip to content

Commit 23b6d9c

Browse files
committed
slightly improved logging
1 parent 049d19f commit 23b6d9c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Diff for: handler/handler.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,24 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
129129
handler.synchronizer.DataMux.RUnlock()
130130

131131
case *lsp.DidOpenTextDocumentParams:
132-
// method "textDocument/didOpen":
132+
// method "textDocument/didOpen"
133133
uri = p.TextDocument.URI
134+
log.Printf("--> didOpen(%s)", uri)
135+
134136
handler.synchronizer.DataMux.Lock()
135137
res, err := handler.didOpen(ctx, p)
136138
handler.synchronizer.DataMux.Unlock()
139+
137140
if res == nil {
138-
log.Println(" notification is not propagated to clangd")
141+
log.Println(" --X notification is not propagated to clangd")
139142
return nil, err // do not propagate to clangd
140143
}
144+
145+
log.Printf(" --> didOpen(%s)", res.TextDocument.URI)
141146
params = res
142147

143-
case *lsp.CompletionParams: // "textDocument/completion":
148+
case *lsp.CompletionParams:
149+
// method: "textDocument/completion"
144150
uri = p.TextDocument.URI
145151
log.Printf("--> completion(%s:%d:%d)\n", p.TextDocument.URI, p.Position.Line, p.Position.Character)
146152

@@ -346,7 +352,6 @@ func (handler *InoHandler) didOpen(ctx context.Context, params *lsp.DidOpenTextD
346352
// Add the TextDocumentItem in the tracked files list
347353
doc := params.TextDocument
348354
handler.trackedFiles[doc.URI] = doc
349-
log.Printf("--> didOpen(%s)", doc.URI)
350355

351356
// If we are tracking a .ino...
352357
if doc.URI.AsPath().Ext() == ".ino" {
@@ -364,7 +369,6 @@ func (handler *InoHandler) didOpen(ctx context.Context, params *lsp.DidOpenTextD
364369
Version: 1,
365370
},
366371
}
367-
log.Printf(" message for clangd: didOpen(%s)", newParam.TextDocument.URI)
368372
return newParam, err
369373
}
370374
}

Diff for: handler/syncer.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package handler
22

33
import (
44
"context"
5-
"log"
65
"sync"
76

87
"github.com/sourcegraph/jsonrpc2"
@@ -31,11 +30,11 @@ func (ah AsyncHandler) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jso
3130
ah.synchronizer.FileMux.Lock()
3231
defer ah.synchronizer.FileMux.Unlock()
3332
if enableLogging {
34-
log.Println("Message processing locked for", req.Method)
33+
// log.Println("Message processing locked for", req.Method)
3534
}
3635
ah.handler.Handle(ctx, conn, req)
3736
if enableLogging {
38-
log.Println("Message processing unlocked for", req.Method)
37+
// log.Println("Message processing unlocked for", req.Method)
3938
}
4039
}()
4140
} else {

0 commit comments

Comments
 (0)