exigow / intellij-gdscript

Godot Engine and GDScript support plugin for IntelliJ based IDEs
MIT License
149 stars 10 forks source link

Propose code formatting implementation #80

Open idobbins opened 3 years ago

idobbins commented 3 years ago

I plan to get to work implementing GDscript code formatting functionality. There are a few features I would like to see come of this, but the two primary ones are; proper formatting as one types, and being able to hit the Reformat Code/Reformat File buttons and have the code be refactored.

I think that would be a great starting point. Of course there is much more that can be done, but for now, I think this will work well.

idobbins commented 3 years ago

Open to suggestion, other feature requests of course.

exigow commented 3 years ago

@idobbins, FYI I implemented a new lexer that produces indentation tokens as promised. Branch is still WIP, but most of the tests are green. I will publish a new version soon (when it's ready), but if you want, you can familiarize with code. GDScript transition to Grammar Kit is also included: https://github.com/exigow/intellij-gdscript/pull/82

Peek 2021-08-24 01-26

mahulst commented 3 years ago

Not sure if this is exactly what you want, but I use https://pypi.org/project/gdtoolkit/ for formatting code. You can install it, and configure it as an external tool in IntelliJ: image When you map it to a keybinding, it will reformat the file in a consistent manner.