You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Export LSP functionality through @opencode-ai/plugin for custom tools #4410
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
We have very specific requirements for code changes and have built a custom tool in .opencode/tool/ for this purpose. Currently, the LSP module (packages/opencode/src/lsp/index.ts) is only available to opencode's built-in tools and cannot be accessed by custom tools created via @opencode-ai/plugin.
Built-in tools like edit, write and lsp_diagnostics use LSP functions to validate code changes:
The lsp_diagnostics tool would be a good candidate to work around this issue, but packages/opencode/src/tool/lsp-diagnostics.txt says "do not use". When creating custom tools in .opencode/tool/, users can only import from @opencode-ai/plugin, which doesn't expose LSP functionality.
Use Case
If my reading of the source is correct, custom tools that modify code files need to:
Notify the language server of file changes via LSP.touchFile()
Retrieve diagnostics to validate changes via LSP.diagnostics()
Format diagnostic output using LSP.Diagnostic.pretty()
Proposed Solution
Export LSP functionality through @opencode-ai/plugin to enable custom tools to:
Call LSP.touchFile(filepath, waitForDiagnostics) to notify language servers of file changes
Call LSP.diagnostics() to retrieve validation errors and warnings
Access LSP.Diagnostic.pretty() for formatting diagnostic output
Optionally access LSP.hover() for hover information
Alternative Workarounds
Fork opencode and add tools directly to the codebase
Update and use the lsp_diagnostics tool
Use built-in edit/write tools instead of custom editing tools (this violates our requirements)
Activity
rekram1-node commentedon Nov 17, 2025
Yeah that's valid