Open
Conversation
Acepie
commented
Dec 31, 2025
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! assert_source_map { |
Contributor
Author
There was a problem hiding this comment.
this gets us the raw mappings in a state that is ok enough to line up but honestly its pretty hard to get a good visual without a third party html viewer. if people have ideas on how to improve the rendering lmk
Acepie
commented
Dec 31, 2025
Acepie
commented
Dec 31, 2025
| module_name: EcoString, | ||
| src_path: EcoString, | ||
| line_numbers: &'module LineNumbers, | ||
| pub line_numbers: &'module LineNumbers, |
Contributor
Author
There was a problem hiding this comment.
these are pub so that decision can reuse them. this feels slightly off to me but ultimately fine
Acepie
commented
Dec 31, 2025
| @@ -0,0 +1,93 @@ | |||
| use crate::assert_source_map; | |||
|
|
|||
| #[test] | |||
Contributor
Author
There was a problem hiding this comment.
these were all the cases that were unique enough to handle from what i ran into but we might wanna add more over time as people run into things/the markers get added/expanded
Contributor
Author
|
hey @lpil bumping this in case it got lost |
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.
An initial implementation of #2249 based off the implementation that was started #3675 I tried to incorporate the feedback that was left on that pr as best as I could. To separate the sourcemapping logic out of the document printing directly i added a new observer node pattern so that we can call any function/method with the output file position while processing a document. This should theoretically be reusable if we had a need in the future though I'm not entirely sure if there would be one honestly. The bulk of the actual logic is inside the main javascript package where we instrument cursor observer points. essentially whenever we would want to denote a value to map (i.e. an expression, case, etc.) we add a new observer document. I tried writing out the raw mappings to make it a bit easier to line things up but the visualizer https://sokra.github.io/source-map-visualization/# is definitely the easiest way to check this for non trivial programs. I wrote out enough test cases to cover the unique bits but i think we might wanna add more as people try this out/find things that need more robust instrumentation. I think this is in a usable/nice enough state that people could find value in this. I was able to get debuggers working for running tests/a served local web page and it was pretty nice.