JavaDoc code style - align asterisks
Answered
Hi, In Intellij IDEA 2022.2.2 (Ultimate) the deafult code style will format JavaDoc like this:
How do I configure IDEA to align the asterisks, like so:
/**
*
*/
I know this at least has been possible, but I don't know how.
Please sign in to leave a comment.
Do you see the same issue in the editor if you start with a new Javadoc?
Does it make a difference if you hit 'Ctrl+Alt+L' to reformat the code?
Is the issue reproducible with all of the custom plugins disabled and IDE restarted? 'File | Settings | Plugins | ⚙ | Disable all downloaded plugins'
Build #IU-222.4167.29
Yes, the comments are formatted according to the code style when generating new JavaDoc comments and reformatting existing ones, with all downloaded plugins disabled.
I'm a little confused as you make this sound like this is a bug? I would assume this is intended behavior since the JavaDoc comments are correctly formatted according to the code style preview. I'm just wondering how to change it.
Actually, having asterisks aligned is the default behavior, so the preview should be showing a different thing.
Does it help if you restore your code style settings to defaults? (You can export them if you want to save them).
I see, that's interesting!
The "Restore Defaults" option is greyed out, I guess my default settings are unchanged
Indeed.
Do you happen to have any .editorconfig files in your project?
Does it help if you disable the following option and reformat the code again?
If it doesn't, please export your current code style schema (any format), upload it to https://uploads.jetbrains.com and provide the upload id here.
No, there's no .editorconfig file in this particular project. I tried disabling that option, and the bundled editorconfig plugin, but got the same result.
I did find that this problem only seems to appear in comments within the class block (fields, methods and nested classes etc.), the asterisks are aligned in top-level class doc comments!
I've uploaded the code style schema I'm using to test this, not sure it will help much though as it's just one line :)
Upload id: 2022_11_28_2BQnHtDz1tPhteX7aQcpnx (file: Default.xml)
Thanks Isak.
Could you also post a code sample with doc comments in different places, and attach a screenshot of what it looks like for you in the editor?
Absolutely!
It's interesting how each nested class level decreases the indentation by one space. This behavior is also interesting:
Any ideas what could cause this?
Are you sure you tried disabling all downloaded plugins and restarting the IDE afterwards?
Please also upload the logs: Help | Collect Logs and Diagnostics Data (entire archive)
Yes, it happens with all downloaded plugins disabled as well (the behavior from the GIF as well).
I've uploaded the logs and diagnostics data, but I've truncated some older logs with potentially sensitive information that I don't want to share. The logs begin on IDE restart after disabling all plugins, opening a project called "intellij-bug-hunt" and then writing the code picture above.
Upload id: 2022_11_30_vNLXcHmNazQTMXKW7tBDVe (file: logs.zip)
Please try 2022.3 release from https://www.jetbrains.com/idea/download/index.html with the default settings: File | Manage IDE Settings | Restore Default Settings...: https://i.imgur.com/kbrkC7w.png. Can you still reproduce it?
I updated to 2022.3 and restored to default settings, and it does fix the issue! I then imported my backup and the issue was back, so the problem is somewhere in the settings. Any config file I can share? Any suspects?
Does it help if you reset the editor font settings to the defaults? It looks like is starts to render in Italic for some reason.
Yes! Switching to Jetbrains Mono (or any other font) fixes the issue. I normally use a font called Hasklig, which essentially is Source Code Pro but with ligatures. I use version 1.2 with these settings:
Do you think this is a problem with the font or the editor?
Looks like a font issue sine all the other fonts work correctly.