Skip to content

feat(DesignerV2): Added merge/diff view to code editor component#8819

Draft
rllyy97 wants to merge 2 commits intomainfrom
riley/merge-view-code-editor
Draft

feat(DesignerV2): Added merge/diff view to code editor component#8819
rllyy97 wants to merge 2 commits intomainfrom
riley/merge-view-code-editor

Conversation

@rllyy97
Copy link
Contributor

@rllyy97 rllyy97 commented Feb 17, 2026

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

// Reason: No change to any production functionality

What & Why

Added merge view to code editor component.
This will be used for a diff view between draft and prod workflow code in portal.

Impact of Change

  • Users: N/A
  • Developers: CodeEditor component now supports split merge/diff view
  • System: N/A

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in:

Contributors

Screenshots/Videos

image

Copilot AI review requested due to automatic review settings February 17, 2026 22:21
@rllyy97 rllyy97 added the risk:low Low risk change with minimal impact label Feb 17, 2026
@github-actions
Copy link

github-actions bot commented Feb 17, 2026

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: feat(DesignerV2): Added merge/diff view to code editor component
  • Issue: None — title is concise, follows conventional commit style, and clearly describes the change.
  • Recommendation: Keep as-is.

Commit Type

  • Properly selected (feature).
  • Only one commit type selected which is correct.

Risk Level

  • Assessment: The PR description selects Low, and the repo has the risk:low label applied.
  • However, from the code diff this change introduces a new dependency (@codemirror/merge), modifies core editor rendering behavior (new MergeView path and theming changes), and updates package lock. These introduce surface area for runtime/bundle impacts and possible styling regressions.
  • Recommendation: Change the PR Risk Level to Medium (or provide a clear explanation in the PR body explaining why the risk is Low despite adding a dependency and changing core editor behavior). If you want to keep the risk:low label, add a justification section saying e.g. "dependency is small, covered by unit tests, scoped to editor component only, no production API changes" and confirm CI/build size checks passed.

What & Why

  • Current: "Added merge view to code editor component. This will be used for a diff view between draft and prod workflow code in portal."
  • Issue: None — concise and clear.
  • Recommendation: Optionally expand one sentence about how the feature will be toggled/used (e.g., which UX flow will enable showMerge) to help reviewers reason about the change surface.

⚠️ Impact of Change

  • The PR body lists Users: N/A, Developers: CodeEditor component now supports split merge/diff view, System: N/A.
  • Issue: This is mostly fine, but because a new dependency and theming changes were added, it's helpful to call out potential impacts explicitly.
  • Recommendation:
    • Users: Minor UI change — users of Code Editor will see a new diff/merge view when enabled. Note if any user settings toggle this behavior.
    • Developers: New prop API (showMerge, originalValue) — callers must pass originalValue and showMerge to enable merge view. Also a new dependency was added to package.json; run a full install/build to confirm no dependency conflicts.
    • System: Potential bundle size increase and styling/theming surface area. Recommend verifying build size or performance if this component is shipped across many pages.

Test Plan

  • Assessment: The PR body currently marks only "Manual testing completed". The code diff shows unit tests were added/updated under libs/designer-ui/src/lib/editor/codemirror/tests/CodeMirrorEditor.test.tsx which exercise the new showMerge behavior.
  • Issue: The Test Plan checkboxes are inconsistent with the code diff.
  • Recommendation: Update the Test Plan section to check Unit tests added/updated. If manual tests were performed as well, keep that checked too. If E2E tests are not present, either provide a short rationale (e.g., "merge view is purely UI-level and covered by unit tests and visual/manual testing") or add E2E coverage if expected for this repository's standards.

⚠️ Contributors

  • Assessment: Empty.
  • Recommendation: If others contributed (design, PM, reviews), add them to the Contributors section. If there were no contributors beyond the author, you can optionally leave blank — but it's good practice to credit reviewers and designers when applicable.

Screenshots/Videos

  • Assessment: A screenshot is provided in the PR body (image link present).
  • Recommendation: Keep or add extra screenshots showing both panels of the merge view and the read-only original panel to aid visual reviewers.

Summary Table

Section Status Recommendation
Title Keep as-is.
Commit Type Keep as-is.
Risk Level Update to Medium or provide justification for Low and change label accordingly.
What & Why Consider one additional sentence about usage toggle.
Impact of Change ⚠️ Expand to mention bundle/dependency and runtime impact.
Test Plan Update checkboxes: mark Unit tests added/updated; explain E2E omission if applicable.
Contributors ⚠️ Add contributors if applicable; otherwise optional.
Screenshots/Videos Screenshot provided; consider additional screenshots showing both panels.

Final Message
Please update the PR body with the following before removing the needs-pr-update label:

  1. Test Plan: check the Unit tests added/updated box (you added unit tests in libs/designer-ui/tests). If you did manual testing as well, keep that checked. If you intentionally omitted E2E tests, add a short explanation.

  2. Risk Level: either change the selected risk to Medium (and update the label to risk:medium) or keep Low but add a short justification explaining why adding @codemirror/merge and changing editor rendering/theming is still considered Low risk (e.g., limited scope, covered by tests, no prod API changes, validated CI build size/perf).

  3. Impact of Change: expand slightly to mention the new props (showMerge, originalValue), the new dependency, and potential bundle/theming impact so reviewers can focus testing.

  4. Contributors: add any reviewers/designers who contributed or confirm none to improve attribution.

  5. Run CI and confirm there are no build or size regressions — mention the CI status in the PR once green.

Once these updates are made, re-request review and remove the needs-pr-update label. Thanks for the thorough implementation and added unit tests — once the PR body is aligned with the changes and the risk justification is clarified, this should be ready for merge.


Last updated: Tue, 17 Feb 2026 22:37:47 GMT

Copy link
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 adds merge/diff view functionality to the CodeMirrorEditor component in the designer-ui library. The feature enables a split-screen view comparing an original (read-only) version of code against a modified (editable) version, intended for displaying differences between draft and production workflow code in the Azure Portal.

Changes:

  • Added @codemirror/merge dependency to enable split diff/merge view functionality
  • Extended CodeMirrorEditor with originalValue and showMerge props to support merge view mode
  • Fixed ESLint warning in CodeViewV2 component

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
pnpm-lock.yaml Added @codemirror/merge@6.12.0 dependency and updated lock file snapshots
libs/designer-ui/package.json Added @codemirror/merge dependency; reorganized @lezer packages; reformatted files array
libs/designer-ui/src/lib/editor/codemirror/types.ts Added originalValue and showMerge props to CodeMirrorEditorProps interface
libs/designer-ui/src/lib/editor/codemirror/CodeMirrorEditor.tsx Implemented merge view functionality with split-screen diff display; refactored theme configuration
apps/Standalone/src/designer/app/AzureLogicAppsDesigner/CodeViewV2.tsx Added ESLint disable comment for react/display-name rule
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +250 to +251
themeCompartment.of(createFluentTheme(isInverted)),
languageCompartment.of(getLanguageExtension(language)),
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The MergeView uses separate compartments for panel A's theme and language (lines 250-251), but these compartments are the same shared instances used by panel B. The existing theme and language update effects (outside the changed region) only update viewRef.current, which points to panel B in merge mode. This means panel A won't receive theme or language updates after initialization, causing visual inconsistency between the two panels when these props change.

Copilot uses AI. Check for mistakes.
Comment on lines 10 to +11
value?: string;
originalValue?: string;
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The new properties originalValue and showMerge are not documented with JSDoc comments. Consider adding documentation to explain:

  • originalValue: The original/left-side content for merge/diff view
  • showMerge: Whether to enable split merge/diff view mode (shows originalValue on left, value on right)
Suggested change
value?: string;
originalValue?: string;
value?: string;
/**
* Original/left-side content for merge/diff view.
*/
originalValue?: string;
/**
* Whether to enable split merge/diff view mode (shows originalValue on the left and value on the right).
*/

Copilot uses AI. Check for mistakes.
Comment on lines +243 to +282
if (showMerge) {
const mergeView = new MergeView({
a: {
doc: originalValue ?? '',
extensions: [
EditorView.editable.of(false),
EditorState.readOnly.of(true),
themeCompartment.of(createFluentTheme(isInverted)),
languageCompartment.of(getLanguageExtension(language)),
EditorView.theme({
...baseThemeSpec,
'.cm-changedLine': {
backgroundColor: 'rgba(255, 128, 100, .12) !important',
},
'.cm-content': {
backgroundColor: isInverted ? '#252423' : '#f3f3f3',
},
}),
...(lineNumbers === 'on' ? [lineNumbersExtension()] : []),
],
},
b: {
doc: value ?? defaultValue,
extensions,
},
parent: containerRef.current,
});

mergeViewRef.current = mergeView;
viewRef.current = mergeView.b;
onEditorRef?.(editorRef);
onEditorLoaded?.();

return () => {
mergeView.destroy();
mergeViewRef.current = null;
viewRef.current = null;
isInitializedRef.current = false;
};
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The new merge view functionality (showMerge and originalValue props) lacks test coverage. The existing tests in tests/CodeMirrorEditor.test.tsx don't cover the merge view mode. Consider adding tests for:

  • Rendering with showMerge=true and originalValue set
  • Verifying both panels are rendered
  • Ensuring panel A is read-only
  • Testing that getValue() returns the value from panel B (not panel A)

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +185
const baseThemeSpec = {
'&': {
fontSize: `${fontSize}px`,
height: '100%',
minHeight: '100px',
boxSizing: 'border-box',
},
'.cm-scroller': {
overflow: 'auto',
fontFamily: '"SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
fontWeight: '500',
letterSpacing: '0.5px',
lineHeight: '1.4',
},
'.cm-content': {
textAlign: 'left',
padding: '4px 0',
fontVariantLigatures: 'none',
},
'.cm-line': {
padding: '0 4px',
},
'.cm-gutterElement': {
fontFamily: '"SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
fontWeight: '500',
},
'.cm-changedLine': {
backgroundColor: 'rgba(100, 255, 128, .12) !important',
},
};
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The baseThemeSpec object is defined inside the useEffect but is used to construct both the editorTheme and the theme for merge view panel A. This is fine functionally, but note that changes to fontSize prop won't update the merge view since it's only created once on mount. Consider whether fontSize updates should be supported for merge views.

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +35
"@lezer/common": "^1.2.0",
"@lezer/highlight": "^1.2.0",
"@lezer/lr": "^1.4.0",
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The dependency order has been changed to move @lezer packages after @lexical packages. While this doesn't affect functionality (dependencies are resolved alphabetically by package managers), it's inconsistent with typical alphabetical ordering conventions. The original position (after @codemirror packages) was more appropriate since @lezer is related to @codemirror.

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +67
"files": [
"build/lib/**/*",
"src"
],
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The files array formatting has been changed from a single-line array to a multi-line array. This is a stylistic change that improves readability. Consider applying this formatting consistently to other single-line arrays in the file for uniformity, though this is optional.

Copilot uses AI. Check for mistakes.
Comment on lines +16 to 17
// eslint-disable-next-line react/display-name
const CodeViewEditor = forwardRef(({ workflowKind, isConsumption }: CodeViewProps, ref) => {
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

Instead of disabling the react/display-name ESLint rule, consider adding a displayName property to the component after the forwardRef, following the pattern used in CodeMirrorEditor.tsx (line 373 in that file). For example: CodeViewEditor.displayName = 'CodeViewEditor'. This provides better debugging information in React DevTools and follows the established codebase pattern.

Copilot uses AI. Check for mistakes.
Comment on lines +243 to +282
if (showMerge) {
const mergeView = new MergeView({
a: {
doc: originalValue ?? '',
extensions: [
EditorView.editable.of(false),
EditorState.readOnly.of(true),
themeCompartment.of(createFluentTheme(isInverted)),
languageCompartment.of(getLanguageExtension(language)),
EditorView.theme({
...baseThemeSpec,
'.cm-changedLine': {
backgroundColor: 'rgba(255, 128, 100, .12) !important',
},
'.cm-content': {
backgroundColor: isInverted ? '#252423' : '#f3f3f3',
},
}),
...(lineNumbers === 'on' ? [lineNumbersExtension()] : []),
],
},
b: {
doc: value ?? defaultValue,
extensions,
},
parent: containerRef.current,
});

mergeViewRef.current = mergeView;
viewRef.current = mergeView.b;
onEditorRef?.(editorRef);
onEditorLoaded?.();

return () => {
mergeView.destroy();
mergeViewRef.current = null;
viewRef.current = null;
isInitializedRef.current = false;
};
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The merge view is only created during component initialization (in a useEffect with empty dependency array), which means changes to showMerge, originalValue, language, or theme will not recreate or update the merge view. This creates several issues:

  1. If showMerge changes from false to true after mount, the merge view won't appear
  2. If originalValue changes, the left panel (panel A) won't update to show the new original content
  3. Theme changes (via isInverted) will only update panel B, not panel A which uses its own theme compartment
  4. Language changes will only update panel B, not panel A which uses its own language compartment

Consider adding useEffect hooks to handle updates to these props, similar to how theme and language updates are handled for the regular editor view (lines 306-321). For showMerge toggling, you may need to conditionally render different components or reinitialize the editor.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Feb 17, 2026

📊 Coverage Check

The following changed files need attention:

⚠️ libs/designer-ui/src/lib/editor/codemirror/CodeMirrorEditor.tsx - 66% covered (needs improvement)

Please add tests for the uncovered files before merging.

@rllyy97 rllyy97 marked this pull request as draft February 17, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-pr-update risk:low Low risk change with minimal impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments