Skip to content

fix: reopen prettified requests after save - #120

Open
Max-Reisinger wants to merge 1 commit into
usebruno:mainfrom
Max-Reisinger:bugfix/vscode-prettify-request-reopen
Open

Max-Reisinger wants to merge 1 commit into
usebruno:mainfrom
Max-Reisinger:bugfix/vscode-prettify-request-reopen

Conversation

@Max-Reisinger

@Max-Reisinger Max-Reisinger commented Aug 9, 2026

Copy link
Copy Markdown

Description

Prevent VS Code's invisible dirty-state marker from being persisted in a request file when saving does not otherwise change its content.

Problem

Fixes usebruno/bruno#8916.

The custom editor compares the current document after stripping its zero-width dirty marker. When the remaining content already matches the serialized request, it skips the workspace edit and saves the document with the marker still present. That makes the .bru file fail to parse when it is reopened, leaving the editor at "Loading request...".

Fix

  • Compare the complete current document with the clean serialized content so a remaining dirty marker always triggers a workspace edit before saving.
  • Add an E2E regression that prettifies and saves a POST JSON body, re-enters the unchanged save path, closes the editor, and verifies the request can be reopened.
  • Verify the saved .bru file does not contain the zero-width dirty marker.

Screenshots

Not applicable; this fixes file persistence and does not change the UI.

Before After
Request can remain at "Loading request..." after reopening Prettified request reopens successfully

Validation

  • npm run typecheck
  • npm run build
  • VSCODE_PATH=... npm run test:e2e -- tests/e2e/specs/request-body-prettify.spec.ts

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable. (Not applicable: no UI changes.)
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.
  • I've run the claude code review skill locally.

@Max-Reisinger
Max-Reisinger marked this pull request as ready for review August 9, 2026 02:40
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.

Open .bru file freezes in VS Code after I change Body JSON to Prettify and save it

1 participant