Repository navigation
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
The functional fix in packages/opencode/src/session/prompt.ts:844 is correct and well-targeted: matching
|
|
Hi! I noticed both of these PRs fix the same root cause from #42887 (1-based URL line vs 0-based LSP range in session/prompt.ts). I opened #47503 as well — it keeps the same approach but adds the line-0 regression test your review suggested (a symbol starting at LSP line 0 with ?start=1&end=1) and keeps the test diff small (focused additions instead of the whole file rewrite). Happy to defer to yours if you'd like to incorporate the line-0 test — just wanted to flag the overlap so it doesn't get lost. 🙏 |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #42887
Type of change
What does this PR do?
Single-line file selection (startLine === endLine) was never expanded to its enclosing symbol. The check compared
.start.line (LSP 0-based) against start (1-based, parsed from the ?start= query param), so it never matched. The
?.start?.line && guard also skipped symbols on LSP line 0.
Convert the LSP line to 1-based before comparing and assigning, keeping start/end 1-based for the Read tool offset/limit math.
How did you verify your code works?
Traced the index conventions: start feeds the Read tool offset, which is 1-based ( ool/read.ts does opts.offset - 1), while LSP documentSymbol ranges are 0-based (lsp/diagnostic.ts does
ange.start.line + 1 for display). The old comparison mixed the two and could never match; the fix converts to 1-based before comparing.
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist