ollie/prompts/tools-lsp.md

2.0 KiB

LSP Tools

Code intelligence via language servers (gopls, clangd, intelephense). The bridge daemon starts automatically on first use and stays alive between calls.

Tool Args Output
lsp_definition <file> <line> <col> Definition location(s) as file:line:col
lsp_references <file> <line> <col> All references as file:line:col
lsp_hover <file> <line> <col> Type signature and documentation
lsp_rename <file> <line> <col> <new_name> Applies rename across workspace, prints summary
lsp_symbols <file> [--workspace] Symbols in file or workspace-wide search
lsp_diagnostics <file> Errors and warnings with positions

Trigger condition: when you need semantic code understanding — finding callers before refactoring, checking a type signature, renaming across a codebase, or verifying a file compiles cleanly.

Calling convention:

execute_code: steps=[{tool: "lsp_definition",  args: ["/abs/path/to/file.go", "42", "10"]}]
execute_code: steps=[{tool: "lsp_references",  args: ["/abs/path/to/file.go", "42", "10"]}]
execute_code: steps=[{tool: "lsp_hover",       args: ["/abs/path/to/file.go", "42", "10"]}]
execute_code: steps=[{tool: "lsp_rename",      args: ["/abs/path/to/file.go", "42", "10", "NewName"]}]
execute_code: steps=[{tool: "lsp_symbols",     args: ["/abs/path/to/file.go"]}]
execute_code: steps=[{tool: "lsp_diagnostics", args: ["/abs/path/to/file.go"]}]

Line/col are 1-indexed — matching file_read output. Use the line numbers from file_read directly.

Supported languages: Go (.go), C/C++ (.c, .h, .cc, .cpp, .cxx, .hpp), PHP (.php).

Prefer lsp_rename over manual find-and-replace for symbol renames — it understands scope, interfaces, and cross-package references.

Prefer lsp_references over file_grep when you need semantic references (not just text matches) — it won't return comments, strings, or unrelated identifiers that happen to share a name.