Skip to content

Commit 1a4a46c

Browse files
authored
LSP remove verbose debug logging (#4123)
1 parent 3d1db9e commit 1a4a46c

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

private/buf/buflsp/buflsp.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,10 @@ func (l *lsp) newHandler() jsonrpc2.Handler {
127127
l.logger.Debug(
128128
"handling request",
129129
slog.String("method", req.Method()),
130-
slog.Any("params", req.Params()),
131130
)
132131
defer xslog.DebugProfile(
133132
l.logger,
134133
slog.String("method", req.Method()),
135-
slog.Any("params", req.Params()),
136134
)()
137135

138136
replier := l.wrapReplier(reply, req)

private/buf/buflsp/completion.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ func getCompletionItems(
6060
ctx,
6161
"completion: found declaration",
6262
slog.String("decl_kind", decl.Kind().String()),
63-
slog.Any("decl_span_start", decl.Span().StartLoc()),
64-
slog.Any("decl_span_end", decl.Span().EndLoc()),
6563
slog.Int("path_depth", len(declPath)),
6664
)
6765
} else {
@@ -160,8 +158,6 @@ func completionItemsForDef(ctx context.Context, file *file, declPath []ast.DeclA
160158
slog.String("name", def.Name().Span().String()),
161159
slog.String("def_kind", def.Classify().String()),
162160
slog.Int("path_depth", len(declPath)),
163-
slog.Any("decl_span_start", def.Span().StartLoc()),
164-
slog.Any("decl_span_end", def.Span().EndLoc()),
165161
)
166162

167163
// Check if cursor is in the name of the definition, if so ignore.

private/buf/buflsp/file.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ func (f *file) RefreshIR(ctx context.Context) {
275275
ctx, "ir diagnostic(s)",
276276
slog.String("uri", f.uri.Filename()),
277277
slog.Int("count", len(f.diagnostics)),
278-
slog.Any("diagnostics", f.diagnostics),
279278
)
280279
}
281280

@@ -661,12 +660,11 @@ func (f *file) SymbolAt(ctx context.Context, cursor protocol.Position) *symbol {
661660
idx--
662661
}
663662
symbol := f.symbols[idx]
664-
f.lsp.logger.DebugContext(ctx, "found symbol", slog.Any("symbol", symbol))
665663
// Check that cursor is before the end of the symbol. Range is half-open [Start, End).
666664
if comparePositions(symbol.Range().End, cursor) < 0 {
667665
return nil
668666
}
669-
667+
f.lsp.logger.DebugContext(ctx, "found symbol", slog.Any("symbol", symbol))
670668
return symbol
671669
}
672670

private/buf/buflsp/jsonrpc_wrappers.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func (l *lsp) wrapReplier(reply jsonrpc2.Replier, req jsonrpc2.Request) jsonrpc2
3535
l.logger.Debug(
3636
"responding",
3737
slog.String("method", req.Method()),
38-
slog.Any("params", result),
3938
)
4039
}
4140

@@ -58,7 +57,6 @@ func (c *connWrapper) Call(
5857
c.logger.Debug(
5958
"call",
6059
slog.String("method", method),
61-
slog.Any("params", params),
6260
)
6361

6462
id, err = c.Conn.Call(ctx, method, params, result)
@@ -72,7 +70,6 @@ func (c *connWrapper) Call(
7270
c.logger.Debug(
7371
"call returned",
7472
slog.String("method", method),
75-
slog.Any("result", result),
7673
)
7774
}
7875

@@ -84,7 +81,6 @@ func (c *connWrapper) Notify(
8481
c.logger.Debug(
8582
"notify",
8683
slog.String("method", method),
87-
slog.Any("params", params),
8884
)
8985

9086
err := c.Conn.Notify(ctx, method, params)

private/buf/buflsp/symbol.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,18 @@ func (s *symbol) LogValue() slog.Value {
165165
)
166166
}
167167
attrs := []slog.Attr{
168-
slog.String("file", s.span.Path()),
168+
slog.String("path", s.span.Path()),
169169
slog.Any("start", loc(s.span.StartLoc())),
170170
slog.Any("end", loc(s.span.EndLoc())),
171171
}
172172
if imported, ok := s.kind.(*imported); ok {
173173
attrs = append(attrs, slog.String("imported", imported.file.uri.Filename()))
174174
} else if s.def != nil {
175-
attrs = append(attrs, slog.String("def_file", s.def.file.uri.Filename()))
176-
attrs = append(attrs, slog.Any("def_start", loc(s.def.span.StartLoc())))
177-
attrs = append(attrs, slog.Any("def_end", loc(s.def.span.EndLoc())))
175+
attrs = append(attrs,
176+
slog.String("uri", s.def.file.uri.Filename()),
177+
slog.Any("start", loc(s.span.StartLoc())),
178+
slog.Any("end", loc(s.span.EndLoc())),
179+
)
178180
}
179181
return slog.GroupValue(attrs...)
180182
}

0 commit comments

Comments
 (0)