feat(lsp): add LSP tools integration with workspace/configuration support

- Add 7 LSP tools: hover, goto_definition, find_references, document_symbols, workspace_symbols, diagnostics, servers
- Support multiple LSP servers: typescript, gopls, pyrefly, basedpyright, ruff, rust-analyzer, clangd, sourcekit-lsp, ruby-lsp
- Read LSP config from opencode.json with disabled server support
- Handle server requests: workspace/configuration, client/registerCapability, window/workDoneProgress/create
- Send workspace/didChangeConfiguration after initialized for basedpyright compatibility
- Uint8Array-based buffer for reliable LSP message parsing
This commit is contained in:
YeonGyu-Kim
2025-12-04 21:54:02 +09:00
parent b397dd6655
commit 7090fca0fd
9 changed files with 1034 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import type { Plugin } from "@opencode-ai/plugin"
import { builtinAgents } from "./agents"
import { createTodoContinuationEnforcer, createContextWindowMonitorHook } from "./hooks"
import { updateTerminalTitle } from "./features/terminal"
import { builtinTools } from "./tools"
const OhMyOpenCodePlugin: Plugin = async (ctx) => {
const todoContinuationEnforcer = createTodoContinuationEnforcer(ctx)
@@ -14,6 +15,8 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
let currentSessionTitle: string | undefined
return {
tool: builtinTools,
config: async (config) => {
config.agent = {
...config.agent,