-
Notifications
You must be signed in to change notification settings - Fork 4
Automatic update blocks in response to user changes #185
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
base: main
Are you sure you want to change the base?
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 automatic block update functionality that responds to user changes in the editor. The implementation introduces an interval tree data structure to efficiently track code blocks and their output ranges, adds visual indicators in the editor gutter to show block boundaries, and enhances the runtime to maintain block metadata including attributes and error states.
Key Changes:
- Added
IntervalTreedata structure for efficient interval overlap queries - Implemented block metadata tracking system with automatic position updates
- Added visual block indicators in the editor gutter
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 26 comments.
Show a summary per file
| File | Description |
|---|---|
| test/IntervalTree.spec.js | Comprehensive test suite for the new IntervalTree data structure |
| lib/IntervalTree.ts | AVL-balanced interval tree implementation for efficient range queries |
| runtime/index.js | Enhanced runtime to track block metadata and use interval tree for change detection |
| editor/blockMetadata.ts | Block metadata state management with automatic position mapping |
| editor/blockIndicator.ts | Gutter marker implementation for visual block indicators |
| editor/index.js | Integration of block metadata and indicator extensions |
| editor/index.css | Styling for block indicators and debug markers |
| editor/decoration.js | Updated decorations to include block attributes and debug markers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.log(blocks); | ||
|
|
Copilot
AI
Oct 28, 2025
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.
Debug console.log statement should be removed before merging to production.
| console.log(blocks); |
| console.group("rerun"); | ||
| for (const node of nodes) { | ||
| console.log(`Node ${node.type} (${node.start}-${node.end})`); | ||
| } | ||
| console.groupEnd(); |
Copilot
AI
Oct 28, 2025
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.
Debug console logging should be removed before merging to production.
| console.group("rerun"); | |
| for (const node of nodes) { | |
| console.log(`Node ${node.type} (${node.start}-${node.end})`); | |
| } | |
| console.groupEnd(); | |
| // Debug logging removed for production. | |
| const set1 = builder1.finish(); | ||
|
|
||
| // Build the range set for block attributes. | ||
| console.groupCollapsed("Decorations for block attributes"); |
Copilot
AI
Oct 28, 2025
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.
Debug console.groupCollapsed statement should be removed before merging to production.
| console.groupCollapsed("Decorations for block attributes"); |
| // Apply decorations to each line in the block range | ||
| const startLine = state.doc.lineAt(output.from); | ||
| const endLine = state.doc.lineAt(output.to); | ||
| console.log(`Make lines from ${startLine.number} to ${endLine.number} compact`); |
Copilot
AI
Oct 28, 2025
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.
Debug console.log statement should be removed before merging to production.
| console.log(`Make lines from ${startLine.number} to ${endLine.number} compact`); |
| } | ||
| } | ||
| const set2 = builder2.finish(); | ||
| console.groupEnd(); |
Copilot
AI
Oct 28, 2025
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.
Debug console.groupEnd statement should be removed before merging to production.
| console.groupEnd(); |
| console.log("Updated blocks:", blocks); | ||
|
|
Copilot
AI
Oct 28, 2025
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.
Debug console.log statement should be removed before merging to production.
| console.log("Updated blocks:", blocks); |
|
|
||
| console.log("Updated blocks:", blocks); | ||
|
|
||
| console.groupEnd(); |
Copilot
AI
Oct 28, 2025
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.
Debug console.groupEnd statement should be removed before merging to production.
| console.groupEnd(); |
| // Otherwise, we need to update the block attributes according to the | ||
| // metadata sent from the runtime. Most importantly, we need to translate | ||
| // the position of each block after the changes has been made. | ||
| console.group("Updating blocks from the effect"); |
Copilot
AI
Oct 28, 2025
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.
Debug console.group statement should be removed before merging to production.
| to: tr.changes.mapPos(block.source.to, 1), | ||
| }; | ||
| console.log(`output: ${block.output?.from} - ${block.output?.to}`); | ||
| console.log(`source: ${block.source.from} - ${block.source.to}`); |
Copilot
AI
Oct 28, 2025
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.
Debug console.log statements should be removed before merging to production.
| console.log(`source: ${block.source.from} - ${block.source.to}`); |
| console.log(`output: ${block.output?.from} - ${block.output?.to}`); | ||
| console.log(`source: ${block.source.from} - ${block.source.to}`); | ||
| } | ||
| console.groupEnd(); |
Copilot
AI
Oct 28, 2025
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.
Debug console.groupEnd statement should be removed before merging to production.
| console.groupEnd(); | |
Changes
Minor Changes
Memo
2025-10-29