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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve source code location metadata accuracy #8362
fix: improve source code location metadata accuracy #8362
Changes from all commits
11fc31e
f42aa9c
d89022f
22eaaf2
2dea46b
765023d
75aec41
c729829
61312c8
7d3b368
4547d3f
e8c1db9
eedacc9
abd760d
1e2cfa4
42e0f7d
c9ccd6e
8c9198d
16ab649
1533c9f
7410321
56146d0
eab99a4
2c92c2f
9aca05b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
judging from some other code in language tools and the fact that
tracemapping
says it is a drop-in replacement forsource-map
which has line-1-based return values, this should not be doneThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these tests are correct, as source maps are zero line based. There's actually code in
Element/index.js
where it substracts one from the returned location to account for that. Why do you think these are incorrect?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source maps are 0-based, but
locator
is 1-based because it gets printed out to the user and users would expect it to be 1-based:svelte/src/compiler/compile/Component.ts
Line 524 in 9aca05b
I didn't realize that this
loc
is different than what's inlocator
because I missed the-1
here:svelte/packages/svelte/src/compiler/compile/render_dom/wrappers/Element/index.js
Line 590 in b8918fa
it's pretty confusing to me to keep track of where things are 0-based and where they're 1-based. I wonder if we can use this opportunity to make it 0-based everywhere and just make it 1-based at the very last second when it's printed to a user