PhaserEditor2D-v3 icon indicating copy to clipboard operation
PhaserEditor2D-v3 copied to clipboard

Set the style of generated code

Open robinheidrich opened this issue 2 years ago • 4 comments

It would be great if you could set the style of the generated code to match the user code.

For example, you could add an option in phasereditor2d.config.json to decide whether to use single quotes (instead of double quotes) and whether to append a semicolon.

robinheidrich avatar Apr 02 '22 18:04 robinheidrich

Yes, it would be great to have a way of setting up custom code formatting. I think we should define something like "compiler hooks". So, when the compiler generates a new file, it can trigger the hooks, especially, a formatter. I think the best way of doing this is using extensions.

PhaserEditor2D avatar Apr 04 '22 02:04 PhaserEditor2D

Sounds good, would the extension then change the code style after it was generated or how would that work? And would that be a built-in extension?

robinheidrich avatar Apr 04 '22 13:04 robinheidrich

Yes. The extension gets the generated source code and transforms it. It is like a pipe. At the end of the pipe, the code is written to the file. Also, the extension can get some parameters from the phasereditor2d.json.config file.

PhaserEditor2D avatar Apr 04 '22 14:04 PhaserEditor2D

+1🎉 Currently having Prettier ignore directories that contain auto-generated code.

ksmit799 avatar Apr 10 '22 12:04 ksmit799