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 format button the editor #2

Open
rafaeltab opened this issue May 13, 2024 · 3 comments
Open

Add format button the editor #2

rafaeltab opened this issue May 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@rafaeltab
Copy link

Since you're using the monaco editor, you can already do json auto formatting using Shift + Alt + F, add a button for the people that don't know the shortcut, and show a tooltip with the shortcut when you hover over it.

editor.getAction("editor.action.formatDocument").run();
@mohitkumartoshniwal
Copy link
Owner

mohitkumartoshniwal commented May 13, 2024

Thanks for the suggestion and implementation details. I will add it if this issue gets some more upvotes. I am personally not sure whether to have a button just for formatting along with tooltip.

@rafaeltab
Copy link
Author

I noticed that it wasn't there within the first minute of usage. I wanted to write some json in the editor, but the formatting was weird. I looked for the button, and realized that it was the monaco editor so I could probably just use the default shortcut. I think any json editor should really have a format button, and many popular platforms seem to agree. Firebase for example has a format button.

An alternative would be a button to create a popover with some shortcuts that can be used in the editor such as F1 for opening the command pallette, or Shift + Alt + F for formatting. It could contain controls for the graph view also.

@mohitkumartoshniwal mohitkumartoshniwal pinned this issue May 13, 2024
@mohitkumartoshniwal
Copy link
Owner

Yeah, the popover also looks interesting. I will think some more on having just a button for formatting or introducing a popover since I was planning to add shortcuts some time later for the whole application anyways. I will keep this issue open in the meantime. Thanks for the suggestion. It's quite helpful.

@mohitkumartoshniwal mohitkumartoshniwal added the enhancement New feature or request label May 13, 2024
@mohitkumartoshniwal mohitkumartoshniwal unpinned this issue May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants