anomalyco / anomalyco/opencode
Single-line file selection doesn't expand to enclosing symbol (off-by-one)
Open
@kitlangton is already working on this.
Since Aug 16, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Referencing a file with a single-line selection (startLine === endLine) should expand the read range to the enclosing symbol via documentSymbol. The check in packages/opencode/src/session/prompt.ts compares
.start.line (LSP 0-based) against start (1-based selection), so it never matches. The agent reads only the single selected line instead of the whole symbol.
Plugins
None
OpenCode version
dev
Steps to reproduce
- Attach a file with a single-line selection placed on a function/class definition.
- The agent reads only that one line instead of the enclosing symbol.
Operating System
Windows 11
Terminal
Windows Terminal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.