intellij-gdscript icon indicating copy to clipboard operation
intellij-gdscript copied to clipboard

Propose code formatting implementation

Open idobbins opened this issue 3 years ago • 3 comments

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 avatar Aug 14 '21 15:08 idobbins

Open to suggestion, other feature requests of course.

idobbins avatar Aug 14 '21 15:08 idobbins

@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

exigow avatar Aug 23 '21 23:08 exigow

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.

mahulst avatar Sep 12 '21 08:09 mahulst