-
Couldn't load subscription status.
- Fork 3
Proper echo context handling #183
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for 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.
Pull Request Overview
This PR implements proper echo context handling to ensure that echo calls within functions output to the executing cell rather than the cell where the function was defined. This addresses issues with nested functions, async callbacks, and functions passed as arguments.
Key Changes:
- Introduces a transpilation system that rewrites function bodies to capture and manage echo context
- Migrates from standalone
clear()function toecho.clear()method for API consistency - Adds comprehensive test coverage for various echo usage patterns (functions, classes, recursion, async operations)
Reviewed Changes
Copilot reviewed 31 out of 35 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| runtime/transpile.js | New transpiler that rewrites echo calls in functions to handle context properly |
| runtime/sourcemap.js | New source mapping utility for code transformations |
| runtime/index.js | Updated runtime to integrate transpiler and manage echo context with __getEcho__/__setEcho__ |
| test/transile.spec.js | New test validating transpiler output for block statements |
| test/js/*.js | New test fixtures for various echo usage patterns |
| test/output/*.js | Expected output files for test cases |
| app/docs/*.recho.js | Updated documentation examples to use echo.clear() |
| editor/completion.js | Updated autocomplete to suggest echo.clear() |
| runtime/stdlib/index.js | Fixed import path for controls |
| test/stdlib.spec.js | Fixed import path for stdlib |
| package.json | Added acorn-walk dependency |
| LICENCE | Added license notice for Observable Notebook Kit |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.