Skip to content

Add Diff application - #6

Merged
LucianCrainic merged 5 commits into
developfrom
feature/apply-diffs
Oct 26, 2025
Merged

LucianCrainic merged 5 commits into
developfrom
feature/apply-diffs

Conversation

@LucianCrainic

Copy link
Copy Markdown
Owner

This pull request introduces several new features and UI improvements to the JSONBro VS Code extension, focusing on enhancing the diff/merge workflow for JSON files. The main changes include new "Apply All" and "Reject All" buttons for diffs, improved control buttons for the JSON panels, and robust state management and testing for diff application and reversion.

Diff/Merge Panel Enhancements:

  • Added "Apply All" and "Reject All" buttons to the diff result panel, allowing users to apply or reject all differences at once. These buttons are styled for clarity and only appear when diffs are present. (src/webview-content.ts, src/webview/controller.ts) [1] [2] [3]
  • Implemented new control buttons in the left and right JSON panels: "Copy Left JSON", "Clear Left JSON", and "Clear Right JSON", each with appropriate icons and tooltips. (src/webview-content.ts, src/webview/controller.ts) [1] [2] [3]
  • Improved the arrangement and styling of all panel control buttons for a more intuitive user experience. (src/webview-content.ts)

Diff Item UI and State Management:

  • Added detailed CSS for individual diff item action buttons (such as per-diff apply/reject), including hover/active states and visual cues for applied/rejected diffs. (src/webview-content.ts)
  • Introduced state management for diffs using a Map to track pending, applied, or rejected states for each diff, and methods to update UI accordingly. (src/webview/controller.ts) [1] [2]

Testing and Robustness:

  • Added comprehensive tests for diff application and reversion, covering property and array changes, nested structures, and ensuring immutability of original objects. (src/webview/__tests__/diff.test.ts)

General Improvements:

  • Ensured that clearing JSON panels or diff output also resets all relevant state and hides action buttons, preventing stale UI or state. (src/webview/controller.ts)
  • Bumped the extension version to 0.2.9. (package.json)

@LucianCrainic
LucianCrainic merged commit 44524d4 into develop Oct 26, 2025
@LucianCrainic
LucianCrainic deleted the feature/apply-diffs branch October 26, 2025 20:33
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.

1 participant