indentWithTabs removes leading single space
See original GitHub issueHaving standard Javadoc comments, like:
/**
* <h3>Logging Configuration</h3>
*
...
After running…
spotless {
java {
googleJavaFormat('1.3') // indents with 2 spaces
indentWithTabs(2)
}
}
All Javadoc stars are in the fly-on-the-left-wall position:
/**
* <h3>Logging Configuration</h3>
*
...
See https://github.com/junit-team/junit5/compare/google_java_format#diff-65f0a88c2a9307f19525f2d3c03dc8f3 for a complete example.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:16 (15 by maintainers)
Top Results From Across the Web
Notepad++ convert leading spaces to tabs upon entry
Press [Tab] and [Shift]+[Tab] to add and remove a tab from each line. In the process, the leading spaces had been converted to...
Read more >Indent with tabs, align with spaces - Dmitry Frank
Use tabs for indentation, spaces for alignment: the superior approach. Code is indented and aligned properly, and indentation is flexible. Use spaces for...
Read more >Indent with tabs or spaces? I wish I didn't need to know.
But tabs and spaces are both invisible by default which leads to mistakes. That's the reason why hostility exists: it's not because one...
Read more >Indent with tabs, align with spaces - Google Groups
Hi,. Is that possible? It solves the tab/space indentation debate, but how is this done in Vim? For example, the code: int main()...
Read more >Indent with Tabs instead of Spaces? - Visual Studio Feedback
We may not be able to pursue this one immediately, but we will continue to ... We have added the feature to our...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Most of the other formatters (or at least eclipse and greclipse) allow you to configure indentation to use tabs in the first place, so I did see this as a GJF-specific usecase.
But you raise a good point, C-style multiline comments are not unusual, we should “just work” for that case. I’m going to open another issue for that.
Proposal 1 (bad idea, probably wouldn’t merge a PR)
We have a mechanism for implicitly modifying license steps based on context, e.g. this is how we keep the license step from messing up
package-info.java
https://github.com/diffplug/spotless/blob/3a845e9c1d8992b12636d680c4aa2e3949d71436/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java#L219-L225
You could add something like:
I think that’s okay, but not great because it’s hard for users to opt out of.
Proposal 2 (okay idea, would happily merge a PR)
A better solution would be to support something like this:
googleJavaFormat().indentWithTabs()
, which I would add roughly herehttps://github.com/diffplug/spotless/blob/3a845e9c1d8992b12636d680c4aa2e3949d71436/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java#L154-L156
and it would look something like this