Repository navigation
fix: remove inaccurate keyword sourcemap locations - #192
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/esrap/c/e9c68501aff9ed520d1419d385c0f8e041d3d1cdOpen in |
🦋 Changeset detectedLatest commit: e9c6850 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Turns out we might also need to map the start of statements ( Also, in a case like this... typeof blah;
let blah;...the error points to the start of |
|
@Rich-Harris agreed that #116 has a bug, but I think this removes more than the bug. Here is what I found, and a way to fix it properly. Where #116 is actually wrong#116 maps keywords in two different ways. The first keyword of a node is mapped at Every later keyword is placed by adding up string lengths: for /* foo */ await /* bar */ (const x of y) {}and on any extra whitespace or line break. Only the arithmetic is guessing. This PR deletes both kinds. Who uses the first-keyword mappingstsrx and Ripple map TypeScript diagnostics from esrap's output back to the source through Volar, which only reports a diagnostic if its start falls inside a mapping. TypeScript puts a fair number of errors on a range that begins with a keyword:
I ran both projects' mapping pipelines against this branch with the same input. Nothing crashes, but mappings silently disappear: tsrx loses its Your own follow-up says the same thing from the debugging side: statement starts like A fix that keeps the exact part and removes the guessing
Net effect compared to this PR: the same bug fixed, every mapping that consumers rely on kept, and the keywords that currently need guessing become exact instead of disappearing. Order#183 keeps all of main's keyword mappings and its
Either way I'd ask that step 1 survives, because that is what tsrx and Ripple are using today. |
dummdidumm
left a comment
There was a problem hiding this comment.
a few findings but on the whole looks good
Closes #190. This reverts the buggy parts of #116 — instead of inserting possibly-fictional mappings for keywords, we only insert mappings around tokens that we know the original location of