feat(callstack): optional source locations and playback line highlight#121
Open
feat(callstack): optional source locations and playback line highlight#121
Conversation
- Add optional source { line, column? } on CallFrameBase and consoleLog frames
- CallstackHelper.addOne merges current execution location from globalThis hook
- Babel-based JS instrumentation before run; benchmark path unchanged
- Python: line probes + execution_location; TrackedList frames carry source
- Fix list comprehension transformer to use __callstack__
- Redux: lastRunCodeSource, codeModifiedSinceRun, markCodeSnapshotStale
- Monaco whole-line decoration; stale after edit or format
- Move runtime context assignment to globalThis for worker compatibility
Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…marter stale - Add SourceLocationSnapshot in shared; callstack imports type from shared only - Instrument only bodies under first return function/arrow (template); fix root body - Mark code snapshot stale only when buffer differs from lastRunCodeSource - Drop redundant clearExecutionSource before run (finally still clears) - Document Python LineTrackingTransformer visit order; extend instrument tests Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
Resolve conflicts in package.json (keep Babel types), pnpm-lock.yaml (pnpm install), and CodePanel (main's format worker flow + markCodeSnapshotStale after format).
…r merge - Prettier wrap setExecutionSource; babel types import as babelTypes - LandingGlowCard: rename x/y to pointerXPct/pointerYPct - useLandingReveal: eslint-disable for reduce/revealed setState; entry in IO callback
…instrumentation - executionSourceContext: clear/set/peek behavior - CallstackHelper.addOne with mocked peek: merge, preserve source, skip error - callstackSlice: frameIndex -1, removeAll snapshot fields, setStatus fields - instrumentUserJs: narrow scope (2 probes), return arrow block body
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
Adds optional
source: { line, column? }on visualization frames (no new frame types). At runtime,CallstackHelper.addOneenriches frames with the current execution location when probes have set it.JavaScript
globalThis.__dstructSetExecutionSource(line, column)before statements only inside the firstreturn function …/return () => …(dStruct template). Top-level JSDoc and other code outside that subtree are not instrumented. Falls back to raw code if no matching return.traverseskips the root path).source).setGlobalRuntimeContextassigns ontoglobalThis.Python
LineTrackingTransformerinsertsset_execution_sourcebefore statements after list tracking.TrackedListattachessourcefromexecution_location.__callstack__inarray_tracker_transformer.py.generic_visitorder for nested functions.Types / layering
SourceLocationSnapshotlives in#/shared/lib/sourceLocationSnapshot;callstackSliceuses it forCallFrameSource.executionSourceContextuses the same type (no domain → codeRunner type dependency).UI / Redux
selectPlaybackSourceLinewalks backward fromframeIndex.dstruct-editor-playback-line.markCodeSnapshotStaleonly when buffer text differs fromlastRunCodeSource(undo back to run text keeps highlights). Format still forces stale.Tests
Dependencies
@babel/generator,@babel/parser,@babel/traverse,@babel/types+ dev@types/babel__*