opencode
opencode copied to clipboard
feat: add unified LSP tool
Summary
Playing around with this, originally came from oh-my-opencode that makes these each individual tools, this unifies them into one tool. Still not sure I like the structure of it, feels like it dumps a lot into context
AI generated below:
Add a new lsp tool that exposes LSP functionality to the model, enabling intelligent code operations across all supported languages.
Supported Actions
- hover: Get type info at position
- definition: Jump to symbol definition
- references: Find all usages
- documentSymbols: Get file symbol outline
- workspaceSymbols: Search symbols by name
- diagnostics: Get errors/warnings
- prepareRename: Check if rename is valid
- rename: Rename symbol across workspace (auto-applies edits)
- codeActions: Get available code actions (quickfixes, refactors)
- codeActionResolve: Apply a code action
Key Features
- Works with all 25+ LSP servers already configured in opencode (TypeScript, Go, Rust, Python, etc.)
- Automatically routes to the correct LSP server based on file extension
- Rename operations automatically apply workspace edits across all affected files
- Code actions include relevant diagnostics for quickfixes like "Remove unused import"
Example Usage
{
"action": "rename",
"filePath": "/path/to/file.ts",
"line": 10,
"character": 5,
"newName": "newFunctionName"
}