Update Copilot on Rails views #1449
Draft
motm32 wants to merge 3 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Copilot on Rails webviews to better handle updated/generated markdown plan formats and improves the local plan UX by allowing inline editing of launch/task configuration names.
Changes:
- Expanded markdown parsing compatibility (alternate headings, blockquotes, requirements table fallback, skipping
<details>/<summary>wrappers). - Local plan view: new section ordering/default open behavior + editable launch/task/compound “name” fields with save-to-file flow and error dialog.
- Deployment plan view: rearranged collapsible sections and enriched subscription dropdown options using live Azure subscriptions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/webviews/copilotOnRails/views/utils/parseLocalPlanMarkdown.ts | Skips raw HTML wrappers so structured parsing doesn’t treat <details>/<summary> as content. |
| src/webviews/copilotOnRails/views/utils/parseDeploymentPlanMarkdown.ts | Adds compatibility for alternate section headings, nested headings, blockquoted metadata, and requirements-table fallback. |
| src/webviews/copilotOnRails/views/styles/localPlanView.scss | Styles new launch configuration summary list and editable name inputs. |
| src/webviews/copilotOnRails/views/LocalPlanView.tsx | Adds editable code-block rendering for launch/task configs and routes edit errors to a dialog. |
| src/webviews/copilotOnRails/views/DeploymentPlanView.tsx | Reorders sections and defaults Architecture Diagram to open. |
| src/webviews/copilotOnRails/extension/openDeploymentPlanView.ts | Fetches live subscription names and updates parsed plan data; updates plan file glob name. |
| src/webviews/copilotOnRails/extension/controllers/LocalPlanViewController.ts | Implements updateCodeBlock to persist edits back into the plan markdown file. |
| src/webviews/copilotOnRails/extension/controllers/DeploymentPlanViewController.ts | Stores latest plan data and centralizes posting it to the webview. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+629
to
+650
| const commit = useCallback((next: string) => { | ||
| const trimmed = next.trim(); | ||
| if (!trimmed || trimmed === currentName) { | ||
| setDraft(currentName); | ||
| return; | ||
| } | ||
| const edits = jsoncParser.modify(originalCode, [arrayKey, entry.index, nameKey], trimmed, { | ||
| formattingOptions: { insertSpaces: true, tabSize: 4, eol: '\n' }, | ||
| }); | ||
| const newCode = jsoncParser.applyEdits(originalCode, edits); | ||
| if (!newCode || newCode === originalCode) { | ||
| setDraft(currentName); | ||
| return; | ||
| } | ||
| vscodeApi.postMessage({ | ||
| command: 'updateCodeBlock', | ||
| originalCode, | ||
| language, | ||
| newCode, | ||
| }); | ||
| addCodeEditNote(language, originalCode, newCode); | ||
| }, [currentName, arrayKey, entry.index, nameKey, originalCode, language, vscodeApi, addCodeEditNote]); |
Comment on lines
+92
to
+103
| const firstIdx = normalized.indexOf(originalCode); | ||
| if (firstIdx === -1) { | ||
| void this.panel.webview.postMessage({ command: 'codeBlockUpdateError', error: vscode.l10n.t("Couldn't locate the original block in the plan file. It may have changed.") }); | ||
| return; | ||
| } | ||
| if (normalized.indexOf(originalCode, firstIdx + 1) !== -1) { | ||
| void this.panel.webview.postMessage({ command: 'codeBlockUpdateError', error: vscode.l10n.t('The original block appears more than once in the plan file. Edit the file directly to resolve the ambiguity.') }); | ||
| return; | ||
| } | ||
|
|
||
| const updated = normalized.slice(0, firstIdx) + newCode + normalized.slice(firstIdx + originalCode.length); | ||
| const finalContent = usesCRLF ? updated.replace(/\n/g, '\r\n') : updated; |
Comment on lines
61
to
+73
| export function openDeploymentPlanViewWithContent(content: string, sourceFileUri?: vscode.Uri): void { | ||
| void openDeploymentPlanViewWithContentAsync(content, sourceFileUri); | ||
| } | ||
|
|
||
| async function openDeploymentPlanViewWithContentAsync(content: string, sourceFileUri?: vscode.Uri): Promise<void> { | ||
| const planData = tryParseDeploymentPlan(content, sourceFileUri); | ||
| const liveSubscriptions = await getAvailableAzureSubscriptions(); | ||
| if (liveSubscriptions) { | ||
| planData.availableSubscriptions = liveSubscriptions; | ||
| if (planData.subscription && !liveSubscriptions.includes(planData.subscription)) { | ||
| planData.subscription = ''; | ||
| } | ||
| } |
Comment on lines
41
to
+42
| const lines = markdown.replace(/\r\n/g, '\n').split('\n'); | ||
| const requirements = extractAttributeValueTable(findSectionByName(extractNamedSections(lines), ['Requirements'])); |
Comment on lines
54
to
+63
| const sections = extractNamedSections(lines); | ||
|
|
||
| const mermaidDiagram = extractMermaidBlock(sections['Architecture Diagram'] ?? []); | ||
| const workspaceScan = extractTable(sections['Workspace Scan'] ?? []); | ||
| const decisions = extractTable(sections['Decisions'] ?? []); | ||
| const resources = extractTable(sections['Azure Resources'] ?? []); | ||
| // Support alternate section headings for compatibility with user-authored plans | ||
| const mermaidDiagram = extractMermaidBlock(findSectionByName(sections, ['Architecture Diagram', 'Architecture'])); | ||
|
|
||
| const workspaceScan = extractTable(findSectionByName(sections, ['Workspace Scan', 'Components Detected'])); | ||
|
|
||
| const decisions = extractTable(findSectionByName(sections, ['Decisions', 'Recipe Selection'])); | ||
|
|
||
| const resources = extractTable(findSectionByName(sections, ['Service Mapping', 'Azure Resources', 'Provisioning Limit Checklist'])); |
Comment on lines
+722
to
+725
| function describeTask(t: Record<string, unknown>): string { | ||
| const parts: string[] = []; | ||
| const cmd = typeof t.command === 'string' ? t.command : ''; | ||
| const type = typeof t.type === 'string' ? t.type : ''; |
Comment on lines
+730
to
+733
| const preview = cmd.length > 80 ? `${cmd.slice(0, 77)}\u2026` : cmd; | ||
| parts.push(`Shell task: \`${preview}\``); | ||
| } else if (type === 'npm' && typeof t.script === 'string') { | ||
| parts.push(`Runs npm script: \`${t.script}\`.`); |
Comment on lines
+258
to
+265
| <CodeEditNoteContext.Provider key={i} value={codeEditContextValue}> | ||
| <SectionCard | ||
| section={section} | ||
| collapsible={collapsible} | ||
| defaultOpen={defaultOpen} | ||
| codeEditable={codeEditable} | ||
| /> | ||
| </CodeEditNoteContext.Provider> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The azure-prepare command made some changes to the md file so I updated the deploy view. It now looks something like this:
I also made some updates to the local dev view the biggest being now users can modify the names if the launch configs:
