[PR #5606] feat: add unified LSP tool #11494

Closed
opened 2026-02-16 18:16:20 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5606

State: closed
Merged: No


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"
}
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5606 **State:** closed **Merged:** No --- ## 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 ```json { "action": "rename", "filePath": "/path/to/file.ts", "line": 10, "character": 5, "newName": "newFunctionName" } ```
yindo added the pull-request label 2026-02-16 18:16:20 -05:00
yindo closed this issue 2026-02-16 18:16:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11494