Repository navigation
Send the editor's code untrimmed so line numbers line up - #12
Merged
Merged
Conversation
run() posted `el.code.value.trim()`, but the gutter, walkthrough and "jump to line" buttons index the untrimmed editor text. Any leading blank lines were dropped before analysis, so every note landed that many lines above the code it describes: with two blank lines first, `def double` on editor line 4 was reported on line 2. The code is now sent exactly as typed, and the empty check still uses the trimmed text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UigC7feaY8NkAy9oay3GDW
ethanzhoucool
marked this pull request as ready for review
November 3, 2026 17:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run()inweb/static/app.jspostedel.code.value.trim()to/v1/explain/all-levels. But everything that shows the result indexes the untrimmed editor text: the gutter's note dots and hover cards, the walkthrough's source snippets, and the "jump to line" buttons (el.code.value.split("\n")). When the paste starts with blank lines, the server never sees them, so every line number in the response points that many lines above the code it describes.Example: two blank lines, then
# helpers, thendef double(x): .... The editor showsdef doubleon line 4:Changes
web/static/app.js: sendel.code.valueexactly as typed. The "Nothing to explain" check still trims, so a whitespace-only editor is still rejected client-side. The same untrimmed value goes to the SSE enrichment request and into the share link, so those stay consistent with the editor too.Testing
node --check web/static/app.jspasses./v1/explain/all-levels(output above). The untrimmed request's line numbers match the editor.pytest: 147 passed, 3 skipped (no Python changes).Generated by Claude Code