Closed kicktipp closed 5 years ago
On my better formatted projects I use these formatting rules:
<code_scheme name="tipsy-format">
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value />
</option>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" />
<package name="" withSubpackages="true" static="true" />
</value>
</option>
<option name="RIGHT_MARGIN" value="200" />
<codeStyleSettings language="JAVA">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
They're (probably) IntelliJ specific though.
I can do a full format after we merge #88.
We could try using editorconfig.
Or we could just attach one config for eclipse and one for IntelliJ.. Probably simpler, since editorconfig seems to need a plugin in eclipse.
I have no problem with editorconfig. Its fine for me. Can you export your favourite formatting as editorconfig?
Regards Janning
Am 1. Dezember 2017 20:38:26 schrieb David notifications@github.com:
Or we could just attach one config for eclipse and one for IntelliJ.. Probably simpler, since editorconfig seems to need a plugin in eclipse.
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/tipsy/j2html/issues/89#issuecomment-348594435
I've merged all the settings that were available in the editorconfig-spec now.
Two differences in our formatters now
// mine
* @param writer the current writer
// yours
* @param writer
* the current writer
There are still many other small glitches and this is really annoying. There must be a good way to share a common codestyle. But at the moment it seems to be better to attach one config for eclipse and one for IntelliJ as you proposed. And I try to adapt my formatting as we go...
Two more differences based on the last PR:
* @param writer the current writer
* @param model a model object to provide data for children to render
* @param someLongParamName some doc
@kicktipp can this be closed now?
@tipsy I'm running into the same issue, plus I think you're developing on windows which is committing different new-line characters my mac (I think). How would you feel about the the Google-Java-Format? I ask because it'd be easy to just add a maven plugin to enforce code-style regardless of IDE.
If you prefer your style I wouldn't mind trying to find/configure a maven plugin for you as well. How do you feel about it?
EDIT: I found your .editorconfig file has the setting for end_of_line character set, but my intellij doesn't seem to be respecting it. Not sure what to do about that, so I guess disregard that part for the time being.
I've opened a pull-request to proof of concept what I mean, feel free to hold-off/reject if you have another preference
Absolutely great that you take care of it. I tried before and failed. I wonder why it is so complicated to get the same formatting rules across IDE/OS. This topic must be relevant in each open source project with more than two developers.
By the way: I am developing with Ubuntu/Eclipse/STS So I can test your setup.
Nice! We'll get a good mix of setups that way :)
As far as why it's difficult, I think that's a hard question to answer for a few reasons. The main one is that there's no one size fits all setup for a lot of things. Especially with code being an almost direct representation of how you think and approach problem solving, if something in that setup is counter intuitive for a person (or just out-right gets in the way) it won't be a good fit for that project.
@tipsy I'm running into the same issue, plus I think you're developing on windows which is committing different new-line characters my mac (I think). How would you feel about the the Google-Java-Format? I ask because it'd be easy to just add a maven plugin to enforce code-style regardless of IDE.
If you prefer your style I wouldn't mind trying to find/configure a maven plugin for you as well. How do you feel about it?
A maven plugin to enforce the code-style would be great. I really like the IntelliJ default code-style, but I'm not super picky. I can have a look tomorrow.
You could try the checkstyle plugin. available for intellij, eclipse and maven.
Not all Source files are formatted the same. This leads to many unintended changes as my IDE Eclipse usually formats the source code as soon as I save the file I am editing (Save Actions)
I would like to upload a formatting configuration for eclipse which every developer can use. I would just use eclipse standards with longer lines and some tweaks for special cases. But if you can export yours to the root folder would be fine, too.
Then I would like to format the complete source code with this formatting configuration to have everything formatted with the same rules.