Suggestion: Format Feature

Suggestion


Have you ever wanted to format your code to perfection... Well if this suggestion ever gets approved you might just have the neatest line of code out there. I believe it should be added because why not, i think it should also go under the preferences tab.

Just think about not having the hassle of going back and fixing every line of code that has an error or a formatting mistake.

If you have no idea on what im talking about i just believe that we need a formatting feature in the playcanvas code editor.

There’s an auto indent feature which is pretty close https://developer.playcanvas.com/en/user-manual/scripting/code-editor/#hot-keys

Select text
Ctrl/Cmd + i

But would you consider adding a actual formatting feature that formats wrapped lines? Or is there some type of downside to doing this?

Not entirely sure on what you mean here? What do you mean by wrapped lines?

this: function randomFunction(){console.log("Hello"); alert("hello again");)}

I second that. I think a format on save option is missing in the editor.

It’s tedious to manually formatting code.

Currently, we are still using CodeMirror so are a little limited by that. We have had some thoughts about moving to Monaco but it isn’t on our short term roadmap yet.

Interesting didn’t know about Monaco.

I just did a quick google search and found this repo:

Five years old though :thinking:

With the recent editor move to monaco. Is this feature on the roadmap for the new editor?

EDIT: Shift + ALT + F will format the current document. So it should be relatively easy to implement format on save right?

Yep, that can be an option now. Can you make a feature request on the Editor repo please: https://github.com/playcanvas/editor

1 Like