Skip to content

Renderer to website#48

Merged
logann-tom merged 26 commits intowebsite-masterfrom
rendererToWebsite
Apr 3, 2026
Merged

Renderer to website#48
logann-tom merged 26 commits intowebsite-masterfrom
rendererToWebsite

Conversation

@logann-tom
Copy link
Copy Markdown
Collaborator

No description provided.

liviacutra and others added 15 commits March 19, 2026 02:58
…Added functionality to add webview containers (webviewview/webviewpanel) to the manager so it could work with webviewview provider. Fixed syntax errors in rendering html
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.
…. 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
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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 from media/.
  • 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.js is referenced from src/webview, but there is no extension/src/webview/placer.js in the repo; as a result computeLayout will be undefined and the webview will fail at runtime. Either ship a JS file under src/webview/ (and include it in packaging) or inline/implement the layout logic directly in the webview bundle.
    extension/src/extension.ts:645
  • Inside render(), cls is referenced outside the sortedClasses.forEach((cls) => { ... }) callback, which will throw a ReferenceError and stop rendering. Use hoveredBuilding to look up the hovered class from state.classes (or track the hovered cls explicitly) and guard against hoveredBuilding being null before drawing the UML box.
    extension/src/extension.ts:438
  • patchState() recomputes state.layout from state.classes before applying removed and changed/related updates, so the layout is based on stale data. Apply removals/updates first, then rebuild nodes + recompute layout from the updated state.classes.
    extension/src/extension.ts:367
  • The webview script comments indicate state replaced fileData, but later UI handlers still reference fileData (e.g. export messages). That will throw at runtime and break exporting. Update the webview to consistently use state (or define fileData again) for any exports/messages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +4
import * as vscode from 'vscode';
import { ClassInfo } from './parser/javaExtractor';
import {getWebviewContent} from './extension'

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +22
private webviews: Map<string, ManagedWebview> = new Map();
private lastFullState: any = null;
private messageQueue: Array<{ type: string; payload: any }> = [];

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread extension/src/WebviewManager.ts Outdated
Comment on lines +67 to +79
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,
});
}
}
});
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml
Comment on lines +4 to +12
push:
branches: [main]
paths:
- 'media/**'
pull_request:
branches: [main]
paths:
- 'media/**'

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@logann-tom logann-tom self-assigned this Apr 1, 2026
Jackfu13 and others added 6 commits April 1, 2026 18:46
…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>
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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’t await the returned promise. If it rejects, it can become an unhandled rejection, and rapid successive changes can interleave parses unexpectedly. Await the call (or explicitly void it 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>
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
<script type="module" src="${cityUri}"></script>

Copilot uses AI. Check for mistakes.
Comment thread extension/src/cityWebviewHtml.ts Outdated
Comment thread extension/src/cityWebviewHtml.ts Outdated
export async function activate(context: vscode.ExtensionContext) {
console.log("CODESCAPE ACTIVATED");
const store = new FileParseStore();
const webviewManager = new WebviewManager(context.extensionUri);
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Comment thread extension/src/WebviewManager.ts
Comment thread .github/workflows/ci.yml Outdated
Comment thread extension/src/webview/placer.js Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
logann-tom and others added 3 commits April 2, 2026 20:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
t
Merge branch 'rendererToWebsite' of github.com:pdsl2005/codescape into rendererToWebsite
@logann-tom logann-tom requested a review from crbridget April 3, 2026 00:56
@logann-tom logann-tom merged commit 2e5ea7c into website-master Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants