![]() But might be there are reasons what Stephan mentioned and such thing don't have much use in projects. In general I was a bit surprised that such maven plugins don't exist for IntelliJ so you could supply config for formatter. It used to be available in a free edition, but last time I looked you had to pay for it. Tim Holloway wrote:There's a product called Jalopy that allows very precise control over pretty-printing of source code. But that is something we can probably make so. But with this approach we need to ensure we have consistent code style set-up on all IDE's. I think I'll play with it more to see how it feels a bit in a longer run, so we potentially could use it. So building maven project locally having some changes it saves automatically file, which in turn triggers this plug-in. So it applies current IDE set style upon file save + offers other features (see attached pic). And additionally I do,: Ctrl + Alt (Option) + O, This will remove unused imports and format the import list as well. Is there a way to add a space in self closing tags like only before the slash only in self closing tags in IntelliJ code style formatting settings In Editor Code Style XML Other there is only an option to add a space After tag name, but it also adds space to , which I dont want.I prefer the hot-keys though, For Mac, To format the code : Ctrl + Alt (Option) + L. I did more research over the night though, and discovered an IntelliJ plugin called "Save Actions". Go to Settings > Other settings > Save actions. Well, the idea was to upload such code style file to resources of the project and invoke upon build, so the users wouldn't need to worry whether they got right (if at all) code style set up on their machines and so we'd have a consistent codebase when committing. That is what we started come up with as for a conclusion. Is there a particular reason you want the code to be formatted by Maven? In the end though, it's the programmer's responsibility to make it look good, not some tool. Microservices architecture is now one of the pattern commonly used. Stephan van Hulst wrote:Automatic formatting in your IDE is a tool that you should trigger by hand, to help you do most of it. If using IntelliJ, you can use the Eclipse Code Formatter Plugin to import the same file. Did you face any similar problem, or maybe discovered anything like that, or maybe you have some other ideas/suggestions? So I was up for new searches, so I found this, works with IntelliJ, it does format the code, but it formats based on google style guidelines, and the documentation explicitly states, that "The format cannot be configured by design". ![]() $/eclipse-formatter-config.xmlĪn issue is, that it works with Eclipse IDE only, while I need to work with IntelliJ IDEA. One of closest plugins what I found is reference to project: ![]() So I was thinking about the maven plugin, to which I could supply a custom codestyle configuration file. I'm looking for the way to auto-format code in IntelliJ, specifically during the maven project build.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |