-
-
Notifications
You must be signed in to change notification settings - Fork 258
Conversation
Codecov Report@@ Coverage Diff @@
## master #346 +/- ##
=======================================
Coverage 97.65% 97.65%
=======================================
Files 20 20
Lines 3326 3326
Branches 882 882
=======================================
Hits 3248 3248
Misses 30 30
Partials 48 48
Continue to review full report at Codecov.
|
Can you describe a usecase where a tool wants to change the first line to be something different than 1? |
so specifically what's the usecase for runkit? (which is awesome btw) |
Hey there, I'm from the RunKit team. I've attached an image which should help explain things a bit better. As you can see, cell 2, in this example, starts on line 5. We run each cell through Babel independently. The result is in this example that the generated SourceMap will maps line 1 of cell 2 to line line 1 (rather than line 5 of the notebook). In other words, each cell's first line will always map to line 1. Our current workaround is to just insert new lines before we parse it. This PR will let us clean some of that up. |
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.
I'm fine with that.
@Me1000 I'm curious, since you run each section through babel separately, do you not run into issues where Babel has renamed things? Take for example two snippets with
I'd expect that to fail because Babel renames |
Great question. In short, we're applying our own custom transforms which (among other things) preserve those identifiers. |
Okie doke, cool, just wanted to make sure since compiling separate snippets is not something we officially guarantee to work because of the renaming and such. |
Adding a
startLine
option allows tool authors to more easily co-opt the babylon API with custom preprocessing.Our team at RunKit would benefit from this feature.