Skip to content

feat: implement Sidebar Tree View and Quick Actions for VS Code extension#56

Open
sakshar2303 wants to merge 1 commit intoDaviReisVieira:mainfrom
sakshar2303:feat/vscode-extension-core
Open

feat: implement Sidebar Tree View and Quick Actions for VS Code extension#56
sakshar2303 wants to merge 1 commit intoDaviReisVieira:mainfrom
sakshar2303:feat/vscode-extension-core

Conversation

@sakshar2303
Copy link
Copy Markdown

Description: This PR implements the core functionality for the StackPort VS Code extension, bringing native AWS resource browsing and interaction directly into the IDE.

Key Features:

Native Sidebar Tree View: Adds a robust explorer panel to browse local AWS resources (Services → Resource Types → Individual Resources).
Service Status Indicators: Real-time status for each service (Available/Unavailable) with clear visual cues and tooltips.
Interactive Lambda Invocation: A new command to select functions, provide JSON payloads (with validation), and stream results/logs to a dedicated output channel.
SQS Rapid Messaging: Effortlessly pick a queue and send messages via the Command Palette.
Deep Backend Integration: A new extension-side API client built with fetch that connects to the StackPort backend (configurable via settings).
Implementation Details:

Manifest: Updated package.json with all necessary commands, views, and configurations.
API: Implemented api.ts for efficient backend communication.
UI: Added treeView.ts and commands.ts for a premium, interactive user experience.

@sakshar2303 sakshar2303 mentioned this pull request Apr 14, 2026
13 tasks
@DaviReisVieira
Copy link
Copy Markdown
Owner

DaviReisVieira commented Apr 14, 2026

Great contribution! The tree view architecture is solid, all API endpoints align correctly with the backend, and it compiles cleanly. A few things to address:

Bugs

1. OutputChannel leak (commands.ts:44)
A new OutputChannel is created on every Lambda invocation and never disposed. After multiple invocations you'll accumulate duplicate channels. Create it once and reuse:

let lambdaOutput: vscode.OutputChannel;

function getLambdaOutput(): vscode.OutputChannel {
    if (!lambdaOutput) {
        lambdaOutput = vscode.window.createOutputChannel('StackPort: Lambda');
    }
    return lambdaOutput;
}

2. showResourceDetail not declared in package.json
extension.ts:20 registers stackport.showResourceDetail, but it's missing from contributes.commands. Add it to avoid warnings:

{
    "command": "stackport.showResourceDetail",
    "title": "StackPort: Show Resource Detail",
    "category": "StackPort"
}

3. Path parameters not URL-encoded (api.ts)
Function names and queue names are interpolated directly into URLs. Wrap with encodeURIComponent():

fetch(`${this.endpoint}/api/lambda/functions/${encodeURIComponent(functionName)}/invoke`)

Same for queueName in sendSqsMessage.

Minor

  • out/ has stale compiled output — either rebuild or add to .gitignore
  • Several any types in api.ts where backend response shapes are known

Tests

api.ts is a good candidate for unit tests — mock fetch, verify URL construction, error handling, and response parsing. The tree data provider could also be tested with a mocked API to verify the hierarchy logic. If you'd like, I can write these tests and push them to the branch.

Future: WebSocket support (#19)

And good news!! The current design is WebSocket-friendly. The StackPortTreeProvider already uses the _onDidChangeTreeData event emitter with a refresh() method, so when we implement WS push (see #19), a WebSocket listener can simply call refresh() on incoming resource_change events. No restructuring needed. One small future optimization: adding per-service granular refresh instead of full tree refresh, but that's not blocking.

@DaviReisVieira
Copy link
Copy Markdown
Owner

@sakshar2303 heads up — I just opened #57 which adds a monochrome SVG sidebar icon at vscode-extension/resources/sidebar-icon.svg (derived from the official StackPort logo) and a root-level .vscode/launch.json for easier debugging.

When you update your PR, please change the activity bar icon path in package.json from "icon": "icon.png" to "icon": "resources/sidebar-icon.svg" in the viewsContainers entry. The top-level "icon": "icon.png" should stay as-is since the marketplace needs a PNG.

@sakshar2303
Copy link
Copy Markdown
Author

Thanks for the detailed review! I’m really glad the architecture aligns with the future WebSocket plans.

I’m currently working on the following:

Fixing the leaks/bugs: Implementing the OutputChannel singleton, adding the missing command to package.json, and wrapping path params in encodeURIComponent.

Cleanup: Updating the .gitignore and refining those any types in api.ts.

Icon Update: I’ll pull in the changes from #57 and update the sidebar icon path to the new SVG as requested.

Regarding the tests—that would be a huge help! If you’re still open to writing the unit tests for api.ts and the tree provider, feel free to push them to this branch once I’ve pushed these fixes. I should have the update ready shortly.

@DaviReisVieira
Copy link
Copy Markdown
Owner

Hey @sakshar2303 ! Just wanted to follow up on the review above. If you'd like, I'm happy to pick up the requested changes myself and push them to your branch (or open a companion PR). Totally up to you — just let me know and I'll get it done. No pressure either way!

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.

2 participants