Conversation
…Added functionality to add webview containers (webviewview/webviewpanel) to the manager so it could work with webviewview provider. Fixed syntax errors in rendering html
… fileWatcherFixes
Add Python city support and example workspaces
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
integrated webview manager to work with webviewview alongside panel.
SCRUM-141 + fixed algo bugs
…. Created rudamentary CI pipeline for edits in media and tested rendering code on a local host website
…iew, fixed settings and launch to work with restructured folders
There was a problem hiding this comment.
Pull request overview
This PR appears to move the existing renderer/webview implementation toward a standalone website entrypoint while also restructuring the VS Code extension into the extension/ subfolder and adding a Tree-sitter–based parsing pipeline (Java + Python) with relations + layout utilities and accompanying tests/fixtures.
Changes:
- Added a standalone webpage entry (
web/index.html) that loads the renderer frommedia/. - Rebuilt/relocated extension implementation under
extension/, including new parsers (javaExtractor,pythonExtractor), state store, relations graph, and layout algorithm. - Added CI, ESLint/TS config, and a comprehensive test/fixture set for extractors/relations/layout.
Reviewed changes
Copilot reviewed 8 out of 49 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web/index.html | Adds standalone canvas page that loads media/main.js. |
| src/WebviewManager.ts | Removes old WebviewManager implementation from the root src/. |
| extension/tsconfig.json | Adds TypeScript config for the extension subproject. |
| extension/src/WebviewManager.ts | New manager supporting both WebviewPanel and WebviewView. |
| extension/src/webview/uml.js | Adds UML box renderer utility for canvas. |
| extension/src/webview/renderer.js | Adds isometric grid/building renderer utilities for canvas. |
| extension/src/types/messages.ts | Introduces typed message contract for extension ↔ webview messaging. |
| extension/src/test/watcher.test.ts | Adds tests for FileParseStore lifecycle. |
| extension/src/test/relations.test.ts | Adds tests for dependency graph building + getRelated. |
| extension/src/test/pythonExtractor.test.ts | Adds tests for Python Tree-sitter extraction using fixtures. |
| extension/src/test/parser.test.ts | Adds tests for Java Tree-sitter extraction using fixtures. |
| extension/src/test/layout.test.ts | Adds tests for the layout placer algorithm. |
| extension/src/test/fixtures/VisibilityModifiers.java | Java fixture for modifier parsing tests. |
| extension/src/test/fixtures/StaticMethods.java | Java fixture for static method parsing tests. |
| extension/src/test/fixtures/SimpleClass.py | Python fixture for basic class parsing tests. |
| extension/src/test/fixtures/SimpleClass.java | Java fixture for basic class parsing tests. |
| extension/src/test/fixtures/Printable.java | Java fixture for interface parsing tests. |
| extension/src/test/fixtures/PersonClass.java | Java fixture for constructors/fields parsing tests. |
| extension/src/test/fixtures/NestedAssignments.py | Python fixture for nested control-flow field extraction tests. |
| extension/src/test/fixtures/MultiClass.java | Java fixture for multiple/nested class parsing tests. |
| extension/src/test/fixtures/ModuleLevel.py | Python fixture for module-level extraction tests. |
| extension/src/test/fixtures/MinimalClass.java | Java fixture for minimal class parsing tests. |
| extension/src/test/fixtures/MethodOverloads.java | Java fixture for overload parsing tests. |
| extension/src/test/fixtures/InterfaceWithInnerTypes.java | Java fixture for interfaces with inner types parsing tests. |
| extension/src/test/fixtures/InnerClasses.java | Java fixture for diverse inner class scenarios tests. |
| extension/src/test/fixtures/Inheritance.py | Python fixture for inheritance extraction tests. |
| extension/src/test/fixtures/GenericBaseAndModuleCode.py | Python fixture for generic base + module-code marker tests. |
| extension/src/test/fixtures/DeepNestedClasses.java | Java fixture for deep nesting parsing tests. |
| extension/src/test/fixtures/AsyncDecorated.py | Python fixture for async/decorated function extraction tests. |
| extension/src/test/fixtures/AbstractService.java | Java fixture for abstract class parsing tests. |
| extension/src/test/fixtures/AbstractMethods.java | Java fixture for abstract method parsing tests. |
| extension/src/test/fixtures/AbstractClass.py | Python fixture for abstract class detection tests. |
| extension/src/test/extension.test.ts | Adds a baseline extension test scaffold. |
| extension/src/state.ts | Adds in-memory parse store keyed by URI. |
| extension/src/relations.ts | Adds dependency graph + related-class lookup logic. |
| extension/src/parser/pythonExtractor.ts | Adds Tree-sitter Python extractor producing shared ClassInfo. |
| extension/src/parser/javaExtractor.ts | Adds Tree-sitter Java extractor with inner-class metadata. |
| extension/src/parser.ts | Adds orchestration: parse files, store results, export JSON, compute diffs. |
| extension/src/layout/types.ts | Adds layout node/position types. |
| extension/src/layout/placer.ts | Adds simple layout algorithm (top-level + inner class placement). |
| extension/src/layout/demo.ts | Adds a demo harness for computeLayout. |
| extension/src/JavaFileWatcher.ts | Updates watchers for Java/Python and emits incremental updates via relations graph. |
| extension/src/extension.ts | Reworks activation, commands, webview provider, and embedded webview script. |
| extension/package.json | Adds extension manifest + scripts + deps. |
| extension/package-lock.json | Updates lockfile metadata. |
| extension/eslint.config.mjs | Adds ESLint configuration for TS sources. |
| extension/.vscode-test.mjs | Adds vscode-test-cli config. |
| .vscode/launch.json | Updates launch config to use extension/ as development path. |
| .github/workflows/ci.yml | Adds CI workflow to compile the extension. |
Comments suppressed due to low confidence (4)
extension/src/extension.ts:324
placer.jsis referenced fromsrc/webview, but there is noextension/src/webview/placer.jsin the repo; as a resultcomputeLayoutwill be undefined and the webview will fail at runtime. Either ship a JS file undersrc/webview/(and include it in packaging) or inline/implement the layout logic directly in the webview bundle.
extension/src/extension.ts:645- Inside
render(),clsis referenced outside thesortedClasses.forEach((cls) => { ... })callback, which will throw aReferenceErrorand stop rendering. UsehoveredBuildingto look up the hovered class fromstate.classes(or track the hoveredclsexplicitly) and guard againsthoveredBuildingbeing null before drawing the UML box.
extension/src/extension.ts:438 patchState()recomputesstate.layoutfromstate.classesbefore applyingremovedandchanged/relatedupdates, so the layout is based on stale data. Apply removals/updates first, then rebuild nodes + recompute layout from the updatedstate.classes.
extension/src/extension.ts:367- The webview script comments indicate
statereplacedfileData, but later UI handlers still referencefileData(e.g. export messages). That will throw at runtime and break exporting. Update the webview to consistently usestate(or definefileDataagain) for any exports/messages.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import * as vscode from 'vscode'; | ||
| import { ClassInfo } from './parser/javaExtractor'; | ||
| import {getWebviewContent} from './extension' | ||
|
|
There was a problem hiding this comment.
WebviewManager imports getWebviewContent from ./extension, but extension.ts also imports WebviewManager, creating a circular dependency that can leave getWebviewContent undefined at runtime. Move getWebviewContent into a separate module (e.g. webview/content.ts) that both files can import without cycles.
| private webviews: Map<string, ManagedWebview> = new Map(); | ||
| private lastFullState: any = null; | ||
| private messageQueue: Array<{ type: string; payload: any }> = []; | ||
|
|
There was a problem hiding this comment.
messageQueue is only appended to in broadcastFullState and is never drained/used, so repeated broadcasts to non-ready views will leak memory. Either remove messageQueue entirely (since lastFullState is already resent on READY) or flush queued messages when the webview becomes ready.
| container.webview.onDidReceiveMessage((message) => { | ||
| if (message.type === 'READY') { | ||
| console.log(`Webview ready: ${viewId}`); | ||
| managedWebview.isReady = true; | ||
| // Send full state immediately to new view | ||
| if (this.lastFullState) { | ||
| container.webview.postMessage({ | ||
| type: 'FULL_STATE', | ||
| payload: this.lastFullState, | ||
| }); | ||
| } | ||
| } | ||
| }); |
There was a problem hiding this comment.
The webview message handler only reacts to READY, but the frontend posts OPEN_CLASS_SOURCE and EXPORT_* messages. Those messages will be silently ignored, breaking click-to-open and export features. Add handling here (or expose a callback/event) to forward these messages to extension logic.
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'media/**' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'media/**' | ||
|
|
There was a problem hiding this comment.
This workflow only runs when media/** changes due to the paths filters, but it compiles the extension. Extension changes in PRs won’t be built/checked by CI. Remove the paths restriction or include extension/** so the compile step runs for relevant changes.
…ebviewHtml
- WebviewManager: change 'viewType' in container check to !('viewColumn' in container)
so that WebviewPanel instances wait for the READY handshake before receiving state,
while WebviewView (sidebar) is still marked ready immediately
- cityWebviewHtml: remove dead ternary (both branches returned 'empty')
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pythonparser master
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 67 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
extension/src/JavaFileWatcher.ts:20
- The file watcher callbacks call
this.handleIncrementalChange(...)but don’tawaitthe returned promise. If it rejects, it can become an unhandled rejection, and rapid successive changes can interleave parses unexpectedly. Await the call (or explicitlyvoidit with internal try/catch) to make error handling deterministic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <body> | ||
| <canvas id="cityCanvas"></canvas> | ||
| <script src="${umlUri}"></script> | ||
| <script type="module" src="${cityUri}"></script> |
There was a problem hiding this comment.
The webview HTML loads citystate.js twice (<script type="module" src=...> and then import { CityState } from ... in an inline module). This is redundant and can lead to confusing execution order; prefer a single module entrypoint (either inline module that imports dependencies, or a single src= module).
| <script type="module" src="${cityUri}"></script> |
| export async function activate(context: vscode.ExtensionContext) { | ||
| console.log("CODESCAPE ACTIVATED"); | ||
| const store = new FileParseStore(); | ||
| const webviewManager = new WebviewManager(context.extensionUri); |
There was a problem hiding this comment.
WebviewManager supports an extensionMessageHandler, but the extension instantiates it without one. As a result, messages like OPEN_CLASS_SOURCE from the webview are never handled (the openClassSourceFromClassName helper below is effectively unused). Pass a handler when constructing WebviewManager (or register message handling elsewhere) so user interactions actually trigger extension behavior.
| const webviewManager = new WebviewManager(context.extensionUri); | |
| const handleWebviewMessage = async (message: { type?: string; className?: string }) => { | |
| switch (message?.type) { | |
| case "OPEN_CLASS_SOURCE": | |
| if (typeof message.className === "string" && message.className.length > 0) { | |
| await openClassSourceFromClassName(message.className); | |
| } | |
| break; | |
| default: | |
| break; | |
| } | |
| }; | |
| const webviewManager = new WebviewManager(context.extensionUri, handleWebviewMessage); |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.