Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a keyboard shortcut for beautify request body #2733

merged 5 commits into from
Sep 8, 2021


Copy link

@eimanip eimanip commented Oct 16, 2020

I set the new shortcut to Shift+Ctrl+I. It's the same keyboard shortcut for "Format Document" in VSCode, so I guess it could be a good candidate. Also, most of the current project's hotkeys follow the Shift+Ctrl+[Char] pattern. Feel free to suggest another default shortcut for this feature.

This pull request closes #1851 (partially), closes #1915 .

Screenshot from 2020-10-17 01-53-38

Copy link

CLAassistant commented Dec 6, 2020

CLA assistant check
All committers have signed the CLA.

eimanip and others added 5 commits September 8, 2021 19:35
there's no reason for it to, it's using a global listener (well, `document.body`, but still..)
since this applies to more than just request bodies, I thought it best to keep it generic.  It applies to the timeline, response body, test code, etc.
I noticed a bug that didn't show up before because there was previously no way to beautify (and, thus, trigger this code path) for documents that weren't showing the beautify button.  Now, since the keyboard shortcut will trigger it for everything, what can happen is that the viewport and cursor will reset even if there's nothing to change.  The `_handleBeautify` method before doesn't serve much purpose since all it does is call `_prettify` (and, it was the only thing calling `_prettify`).  Before doing that, though, it's worthless to bother setting the value.  This way, if the document cannot be prettified then it won't be.
I noticed that the comments were messed up (from the flow-to-ts conversion) here.  change it to self documenting code and touched no logic whatsoever.
Copy link

@gatzjames gatzjames left a comment

Choose a reason for hiding this comment

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

Works great! Rebased to merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

[Feature Request] Keyboard shortcut for Beautify [Feature Request] Beautify JSON improvements
5 participants