Skip to content
FunCoding

pi-lens-lsp-navigation

Navigate code with IDE features and run proactive LSP diagnostics on files/folders/batches. Use as PRIMARY for code intelligence and type/error checks.

Star
546
Category
Other
License
MIT
Last commit
Dec 2, 2026

skills/pi-lens-lsp-navigation/SKILL.md

View on GitHub

LSP Navigation and Diagnostics

Use lsp_navigation as PRIMARY for code intelligence. Use lens_diagnostics with source=lsp as PRIMARY for proactive type/error checks. Do NOT use grep/glob/ast-grep first for code intelligence.

Aggregate-tool hosts

Some hosts expose pi-lens through a single aggregate tool — lens(action=...) — instead of registering the standalone names below. On those hosts:

  • Proactive checks: lens({ action: "lsp_diagnostics", ... }) — same parameters as the table below; the cached-report entry point maps to lens({ action: "diagnostics", ... }).
  • If lsp_navigation is not among the aggregate's actions, do not call the standalone name: use the host's structural search funnel (symbol_search → module_report → read_symbol) or the ast-grep CLI for navigation instead.

Diagnostics

Use lens_diagnostics with source=lsp before builds/tests or after touching several files:

NeedTool call
Check one filelens_diagnostics({ source: "lsp", scope: "paths", paths: ["src/file.ts"] })
Check a folderlens_diagnostics({ source: "lsp", scope: "workspace", path: "src/", severity: "error" })
Check exact touched fileslens_diagnostics({ source: "lsp", scope: "paths", paths: ["src/a.ts", "src/b.ts"] })
Slow server (Rust, Java)lens_diagnostics({ source: "lsp", scope: "paths", paths: files, waitMs: 2000 })
Include warningslens_diagnostics({ source: "lsp", scope: "paths", paths: files, severity: "all" })

Prefer explicit paths batches after multi-file edits — bounded concurrency, no unrelated directory noise.

Parameter reference

lens_diagnostics accepts source: "session" | "lsp" and scope: "paths" | "workspace". Use mode: "delta" for the current turn, "all" for the cache-only session view, or "full" for an active scan. path selects one file or directory; paths filters a batch. severity is "error", "warning", or "all"; serverScope is "primary" or "all".

For mode: "full", refreshRunners: "cached" | "cheap" | "all" | "none" (or false/true) controls project analyzers. The first three string modes can launch a fresh heavyweight analyzer pass, bounded by the slowest runner's roughly 180-second ceiling; none disables it. maxProjectFiles limits cheap project runners, maxLspFiles limits the LSP sweep, and includeGenerated: true includes generated-name paths. These three limits apply to full scans. concurrency and waitMs tune LSP batches.

QuestionOperationParameters
Where is this defined?definitionpath, line, character
Where is this symbol's type defined?typeDefinitionpath, line, character
Where is this declared (vs defined)?declarationpath, line, character
Find all usagesreferencespath, line, character
What type is this?hoverpath, line, character
Call signaturesignatureHelppath, line, character (at arg position)
Symbols in this filedocumentSymbolpath
Find symbol across projectworkspaceSymbolquery + path (strongly recommended)
Quick fixes availablecodeActionpath, line, character, endLine, endCharacter
Rename symbol safelyrenamepath, line, character, newName
Who implements this?implementationpath, line, character
Who calls this function?prepareCallHierarchy → incomingCallspath, line, character
What does this call?prepareCallHierarchy → outgoingCallspath, line, character
What commands does the server offer?capabilities(optional path) — lists advertised commands
Run a server command (e.g. organize imports)executeCommandcommand (+ commandArguments); dry-run unless apply:true

The operation values are definition, typeDefinition, declaration, references, hover, signatureHelp, documentSymbol, findSymbol, workspaceSymbol, codeAction, rename, rename_file, implementation, prepareCallHierarchy, incomingCalls, outgoingCalls, executeCommand, workspaceDiagnostics, and capabilities.

For findSymbol, pass query; optionally narrow with kinds, exactMatch, topLevelOnly, and maxResults. rename_file uses newFilePath. symbol resolves a character automatically; character: -1 requests automatic resolution, and symbol#N selects a numbered symbol when the result lists one. callHierarchyItem is the object returned by prepareCallHierarchy and is required by the incoming/outgoing follow-up calls.

Output is text by default, the shape a Neovim LSP user sees: a path:line:col location list for definition, references, implementation and call hierarchy; hover's markdown (a language-bearing snippet as a fenced code block); an indented start-end kind name symbol tree for documentSymbol and findSymbol; path:line:col: severity: message rows for workspaceDiagnostics, under a path (scanned 5m ago) header per file when the snapshot stamped its age; and the rename summary, or the completed edit list after applying (with a warning when the server dropped a conflicting edit). A call-hierarchy entry prints its call sites on indented path:line:col lines under the symbol, and prepareCallHierarchy adds a callHierarchyItem: <json> line carrying the item verbatim. Pass view: "json" only when you need the structured envelope (the pre-text default, byte-identical), for example to parse locations or metadata.searchReads.

An executed executeCommand value is the one exception: its payload is the server's arbitrary JSON, so it prints as compact single-line JSON with no line shape of its own. A command the client refused or timed out prints Not executed: <reason>, plus a warning that a timed-out command may still be changing files.

Call Hierarchy Pattern

// Step 1
lsp_navigation(operation="prepareCallHierarchy", path="src/api.ts", line=42, character=10)
// → symbol line, then `callHierarchyItem: <json>`: pass that JSON back verbatim

// Step 2
lsp_navigation(operation="incomingCalls", callHierarchyItem=<item from step 1>)
lsp_navigation(operation="outgoingCalls", callHierarchyItem=<item from step 1>)

Operational Notes

  • definition returns nothing? The file may not be open/indexed yet. Read it first, then retry.
  • workspaceSymbol empty? Always pass path. Unscoped queries are best-effort and frequently return nothing. If TypeScript returns "No Project", open the scoped file first.
  • references — query from the definition site for full cross-file coverage; usage-site queries can be partial.
  • signatureHelp — only valid at call-site argument positions; declaration positions return empty.
  • workspaceDiagnostics — tracked push snapshot only, not an active check. Use lens_diagnostics with source=lsp when you need fresh results.
  • codeAction — distinguish quickfix from generic refactors ("Move to new file"). Generic refactors are not error fixes.
  • prepareCallHierarchy — server-capability dependent; if unsupported, skip incoming/outgoing calls.

When NOT to Use LSP Navigation

TaskUse Instead
Find patterns (console.log)ast_grep_search
Find text / TODOsgrep
Find files by nameglob
Read file contentread

Golden Rule

Code intelligence → lsp_navigation first. Type/error validation → lens_diagnostics source=lsp first. Text/pattern search → grep/ast-grep.

Similar Skills

claude-handoff

MAmattpocock/skills337k4,978 new stars in the last 7 days

software-factory

MAmattpocock/skills337k4,978 new stars in the last 7 days

agent-payment-x402

AFaffaan-m/ECC315k4,381 new stars in the last 7 days

agent-self-evaluation

AFaffaan-m/ECC315k4,381 new stars in the last 7 days

bengali-nlp

AFaffaan-m/ECC315k4,381 new stars in the last 7 days

ponytail-gain

DIDietrichGebert/ponytail203k4,904 new stars in the last 7 days