mirror of
https://github.com/lukaszraczylo/filepuff-mcp.git
synced 2026-10-12 04:54:27 +00:00
perf(lsp): default find_references to compact output
References defaulted to one line per reference; compact (one line per file, columns collapsed) existed only as opt-in. Compact preserves every line:col pair with zero information loss while cutting roughly one line per reference for the LLM consumer. Default it to true; compact=false and the session compact_refs pref still select the verbose per-reference layout (explicit override wins).
This commit is contained in:
@@ -74,12 +74,14 @@ func (s *Server) handleLSPQuery(ctx context.Context, request mcp.CallToolRequest
|
|||||||
|
|
||||||
case "references":
|
case "references":
|
||||||
includeDecl := request.GetBool("include_declaration", true)
|
includeDecl := request.GetBool("include_declaration", true)
|
||||||
// compact: explicit call-time > session compact_refs pref > false
|
// compact: explicit call-time > session compact_refs pref > true.
|
||||||
|
// Compact (one line per file) is the default — it preserves every
|
||||||
|
// line:col pair while cutting ~one line per reference for the LLM consumer.
|
||||||
var prefsCompact *bool
|
var prefsCompact *bool
|
||||||
if sp := s.sessionPrefs.Load(); sp != nil {
|
if sp := s.sessionPrefs.Load(); sp != nil {
|
||||||
prefsCompact = sp.CompactRefs
|
prefsCompact = sp.CompactRefs
|
||||||
}
|
}
|
||||||
compact := effectiveBool(request, "compact", prefsCompact, false)
|
compact := effectiveBool(request, "compact", prefsCompact, true)
|
||||||
return s.lspReferences(ctx, file, line, col, includeDecl, compact, verbose)
|
return s.lspReferences(ctx, file, line, col, includeDecl, compact, verbose)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ func (s *Server) registerTools() {
|
|||||||
mcp.Description("Include the declaration in results. Only valid for action=references (default: true)."),
|
mcp.Description("Include the declaration in results. Only valid for action=references (default: true)."),
|
||||||
),
|
),
|
||||||
mcp.WithBoolean("compact",
|
mcp.WithBoolean("compact",
|
||||||
mcp.Description("Compact output: one line per file with all refs in brackets. Only valid for action=references. Default: false."),
|
mcp.Description("Compact output: one line per file with all refs in brackets. Only valid for action=references. Default: true; set false for one line per reference."),
|
||||||
),
|
),
|
||||||
mcp.WithBoolean("verbose",
|
mcp.WithBoolean("verbose",
|
||||||
mcp.Description("Emit count/header preamble. Applies to all actions. Default: false."),
|
mcp.Description("Emit count/header preamble. Applies to all actions. Default: false."),
|
||||||
|
|||||||
Reference in New Issue
Block a user