-
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.
# Conflicts: # editor/index.js # package.json # pnpm-lock.yaml # runtime/index.js # test/main.js
# Conflicts: # lib/blocks/detect.ts
# Conflicts: # pnpm-lock.yaml
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
Copilot reviewed 56 out of 62 changed files in this pull request and generated 5 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Helper function to create a map (unused in current implementation) | ||
| function createMap(rows, cols, numBlocks) { | ||
| const blockages = Array.from({length: numBlocks}).map(_ => blockage(rows, cols)); | ||
| const test = (x, y) => blockages.some(b => inside(b, x, y)); | ||
| const map = Array.from({length: rows}) | ||
| .map((_, y) => Array.from({length: cols}).map((_, x) => test(x, y) ? WALL : AIR)); | ||
| return map; | ||
| } | ||
|
|
Copilot
AI
Dec 25, 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.
Unused function createMap.
| // Helper function to create a map (unused in current implementation) | |
| function createMap(rows, cols, numBlocks) { | |
| const blockages = Array.from({length: numBlocks}).map(_ => blockage(rows, cols)); | |
| const test = (x, y) => blockages.some(b => inside(b, x, y)); | |
| const map = Array.from({length: rows}) | |
| .map((_, y) => Array.from({length: cols}).map((_, x) => test(x, y) ? WALL : AIR)); | |
| return map; | |
| } |
| tr.changes.forEach((change, idx) => { | ||
| const deleted = change.to - change.from; | ||
| const inserted = change.insert.length; | ||
| const samePos = change.from === change.to; |
Copilot
AI
Dec 25, 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.
Unused variable samePos.
| { | ||
| echo.set("typeface", "Google Sans Code"); | ||
| echo(renderState(state)); | ||
| } | ||
|
|
||
| // State management: tracks the three rooms (BFS, DFS, A*) and animation status | ||
| const [state, setState] = recho.state(createState()); | ||
|
|
Copilot
AI
Dec 25, 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.
Variable 'state' is used before its declaration.
| { | |
| echo.set("typeface", "Google Sans Code"); | |
| echo(renderState(state)); | |
| } | |
| // State management: tracks the three rooms (BFS, DFS, A*) and animation status | |
| const [state, setState] = recho.state(createState()); | |
| // State management: tracks the three rooms (BFS, DFS, A*) and animation status | |
| const [state, setState] = recho.state(createState()); | |
| { | |
| echo.set("typeface", "Google Sans Code"); | |
| echo(renderState(state)); | |
| } |
| } | ||
| // Process queue until exit found | ||
| while (q.length > 0) { | ||
| const u = q.shift() // Process nodes in order (FIFO) |
Copilot
AI
Dec 25, 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.
Avoid automated semicolon insertion (93% of all statements in the enclosing function have an explicit semicolon).
| const u = q.shift() // Process nodes in order (FIFO) | |
| const u = q.shift(); // Process nodes in order (FIFO) |
| const steps = [], W = m[0].length, H = m.length; | ||
| // Recursive visit function: explores one path until dead end or goal | ||
| function visit(p, x, y) { | ||
| const k = key(x, y) |
Copilot
AI
Dec 25, 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.
Avoid automated semicolon insertion (91% of all statements in the enclosing function have an explicit semicolon).
Changes
Minor Changes
Memo
2025-10-29