fix(vscode): fall back to active pipeline editor for commands#375
fix(vscode): fall back to active pipeline editor for commands#375techadnank9 wants to merge 2 commits intorocketride-org:developfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughCentralizes pipeline URI and source-component resolution into a new helper module and updates three VS Code sidebar command handlers to use the shared resolvers; commands now fail earlier when URI or pipeline context cannot be determined. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/vscode/src/providers/SidebarFilesProvider.ts`:
- Around line 223-225: The active-editor fallback assumes the parsed-file cache
is already populated and can return undefined projectId/source; fix
SidebarFilesProvider by parsing the resourceUri on demand when item?.parsedFile
is falsy: call the parsing helper used by loadPipelineFiles (or add a new
synchronous/awaitable parsePipelineFromUri helper) inside the code paths that
compute parsedFile/projectId/source (the locations using parsedFile?.projectId
and parsedFile?.pipeline, and the similar block at lines ~341-347) and await it
before calling the connection manager; alternatively, fail fast with a clear
error before execute if parsing cannot produce projectId/source. Ensure
getParsedPipeline (or the new helper) is awaited where invoked (see the note
about awaiting at line 159).
- Line 146: The code opens pipeline files with
vscode.commands.executeCommand(..., 'rocketride.PageEditor') but later checks
vscode.window.activeTextEditor?.document.uri (which is undefined for custom
editors), so replace that check with the Tabs API: get
vscode.window.tabGroups.activeTabGroup.activeTab and if tab?.input instanceof
vscode.TabInputCustom use (tab.input as vscode.TabInputCustom).uri as the active
URI; otherwise fall back to vscode.window.activeTextEditor?.document.uri; update
the logic around where activeTextEditor is referenced (the code relying on
activeTextEditor/document.uri) to use this Tabs API check so the custom
rocketride.PageEditor tab is detected correctly.
In `@apps/vscode/src/test/sidebarCommandContext.test.ts`:
- Around line 28-59: The test file only calls the pure helper
resolvePipelineCommandUri with synthetic { fsPath } objects, so it never
exercises the command path in SidebarFilesProvider where item === undefined and
parsedFiles may be empty; add a provider-level test that invokes the actual
command handler on SidebarFilesProvider (e.g., call the command method that uses
parsedFiles and item) with a mocked VS Code active editor/tab state and no
sidebar selection, asserting the command falls back to the active editor when
it's a .pipe or .pipe.json and returns undefined for non-pipeline files; mock or
stub the provider's parsedFiles and the VS Code API objects
(activeTextEditor/tab) to reproduce the real command-path behavior and verify
the regression is caught.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 26506c5b-22ca-4917-93c9-6e859ffe7c73
📒 Files selected for processing (3)
apps/vscode/src/providers/SidebarFilesProvider.tsapps/vscode/src/providers/sidebarCommandContext.tsapps/vscode/src/test/sidebarCommandContext.test.ts
|
hi @techadnank9 - please review and address/resolve all the coderabbitai comments/feedback. |
No pipeline file selectedorNo pipeline selectedwhen a valid.pipefile was already open in the active editor but no sidebar item was selected..pipeor.pipe.jsoneditor when noPipelineFileItemis passed, and applies it to the open file, open status, and run pipeline command paths.Type
fix
Testing
./builder testpassesLocal verification performed: