Skip to content
Closed
Prev Previous commit
Next Next commit
Fix lsp.ts: remove unreachable workspaceSymbol check and move positio…
…n vars after line/character validation
  • Loading branch information
VladD2 committed May 10, 2026
commit 1170f19213471cf43a1a37afae12859befdbaaa3
12 changes: 4 additions & 8 deletions packages/opencode/src/tool/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,7 @@ export const LspTool = Tool.define(
})

const uri = pathToFileURL(file).href
const position = { file, line: args.line - 1, character: args.character - 1 }
const relPath = path.relative(instance.worktree, file)
const detail =
args.operation === "workspaceSymbol"
? ""
: args.operation === "documentSymbol"
? relPath
: `${relPath}:${args.line}:${args.character}`
const title = detail ? `${args.operation} ${detail}` : args.operation

const exists = yield* fs.existsSafe(file)
if (!exists) throw new Error(`File not found: ${file}`)
Expand All @@ -103,6 +95,10 @@ export const LspTool = Tool.define(
throw new Error(`line and character are required for operation '${args.operation}'`)
}

const position = { file, line: args.line - 1, character: args.character - 1 }
const detail = `${relPath}:${args.line}:${args.character}`
const title = `${args.operation} ${detail}`

const result: unknown[] = yield* (() => {
switch (args.operation) {
case "goToDefinition":
Expand Down
Loading