Comment folding

已回答

I _think_ this is a new issue …

I have always used comments like /***************************/ to mark the starts of functions and the starts of code blocks within functions.  I find this makes it easy to navigate my way through my code at a glance.

I have recently updated Intellij IDEA to 2026.1.1, and comments like this have vanished, to be replaced by small vertical lines, which makes navigating much more difficult.

Also ‘proper’ comment blocks come out in a revised format seem sometimes to come out a new format which is marginally more difficult to edit.

Is there some way of switching off this feature?  (Various LLMs have suggested that the relevant option does exist, but have pointed all over the place, and none of the things they suggest seems to exist.)

Thanks

0

Hi Jamie,

Starting with Java 23, JavaDoc comments can be written using Markdown - which is denoted by the /// pattern.

Normally, IDEA doesn't apply this style by itself - unless you manually (or via Actions on Save) trigger the corresponding inspection.

Things you can try now to fix the issue:

  • Search your IDE's local history for earlier versions of affected files and restore them
  • Use Find/Replace in Files to manually find all occurrences of /// and replace them

0

Hi Arina,

Thanks very much for getting back to me so quickly.

I've never actually used /// as a comment marker, so I guess that's not going to be the issue.  But I do have tens of thousands of lines of code, some newish files and some much older, all of which contain this /*********…***/ separator, and it's rather painful no longer being able to see them in the editor unless I show each one indiviually.

I know in the past that occasionally I've hit some key combination which has caused odd things to happen more generally, and it's then often taken quite a long time to find out how to undo them.  And I _guess_ the same may have happened here – although this time there doesn't seem to be any way at all to get back to the previous behaviour.  Certainly I haven't used any of the menus etc to make any overt configuration changes.

Thanks for your comments, though – much appreciated.

Jamie

0

Should've said …  when I see the vertical bar, I can turn it back into proper comments using ‘Toggle rendered view’ (Ctrl-Alt-Q).  But I can only do that on an individual basis – I can't find a way either of doing to globally or of configuring things permanently so that I don't have the problem.

0

Aah, you are referring to this vertical bar:

Sorry, misunderstood you earlier a little bit.

Yes, it is the rendered mode for Javadoc comments. You can disable it globally using either of the approaches below:

  • In the editor gutter, right-click Toggle Rendered View and unselect Render All Doc Comments:

  • Alternatively, open Settings (Ctrl+Alt+S), go to Editor | General | Appearance, and unselect Render documentation comments:

0

Hi Arina,

Once again, thank you very much for spending time on this.  Unfortunately I don't seem to be able to get anything to force the ‘correct’ formatting.

Here is what I am seeing currently:

If I click right on the vertical bar itself, I see:

so indeed ‘Render all Doc Comments’ is not ticked.

In Settings I have:

So once again, not ticked.

The only way I can change the appearance is if I use ‘Toggle Rendered View’ (Ctrl-Alt-Q), when I get to see:

However, this affects only this one line – if I want other similar lines in the file to show up it looks as though I have to do each of them individually.

I guess perhaps this is a ‘feature’ of the most recent version of the IDE, and it may perhaps not be worth you spending more time on it, although I very much appreciate the input you have already supplied.

Regards,

Jamie

0

Hi Jamie,

No worries at all, I am here to help sort it out.

I tested the behavior just now in a Kotlin project using the latest 2026.1.1 on Windows 10. No issues. With the setting enabled, even when I change the style to rendered, it changes back to text-only upon reopening the file.

It could be that some of the config files got corrupted (e.g. by 3rd-party plugins or because of errors during IDE update).

Let's try the following things to try and rectify this:

  1. Temporarily disable ALL non-bundled plugins and restart the IDE: File | Settings | Plugins | ⚙ | Disable all downloaded plugins
  2. Reset IDE settings to defaults (a backup copy will be created in the process): File | Manage IDE Settings | Restore Default Settings

 

The same problem was also reported in IJPL-228262, but it has not been triaged yet.

If the steps above don't help, could you collect your IDE's logs (Help | Collect Logs…), upload them securely to our server and share the Upload ID here so that I can look for exceptions and check the general flow of events there?

Also, a tiny reproducer project would help a lot in identifying the root cause. You can upload it as part of the same bunch.

Thanks!

0

Apologies for the delay.  I _will_ get back to you, but I have some other work I need to sort out first.

Jamie

0

Sorry for the delay.  I have tried a little more experimentation, including disabling downloaded plugins etc as you suggested above.  I have a little more information, although whether it will be helpful or not, I don't know …

The file in which I was originally seeing this was one which I had put together under a previous version of the IDE – don't know if that's significant.

In the earlier version of the IDE, the entire file, comments included, was in plaintext form using a monospaced font, and in particular all of the /******/ comment lines were visible as such.

In the new IDE I think _all_ comments started out in formatted form (proportionally spaced font), and the /****/'s were being suppressed and were visible only as small vertical bars in the left margin.

As soon as I clicked on the pencil icon to edit a comment, the comment reverted to the previous monospaced format – and if I clicked the pencil as though to edit the /*****/, that, too became visible.

Once I'd done this to a particular comment, the monospaced setting (and the visibility of the /****/) was retained forever.  But only for those comments I'd actually edited – I couldn't find any way of changing all comment settings en masse to force /*********/ to be visible.

I have tried creating a small test file to reproduce the issue, but I _think_ this is behaving differently (not sure).  Images attached.  As first set up, all of the comments are formatted (proportionally spaced):

 

If I then add a /****/ line above main, 

then not only does that line remain visible (which indeed was also the case with the earlier Kotlin file – if I added stuff it was automatically monospaced and visible), but also the comments below it (but not above it) in the second image above are forced to monospace.

I'd be very happy to supply logs, but am not sure what you may need.  At present I have plugins disabled and the IDE default settings.  Should I supply the logs as they stand, or do I need to re-enable things and supply the logs then?

Jamie

0
This matches a known bug already reproduced by our dev team in 2026.1.1, tracked as [IJPL-228262](https://youtrack.jetbrains.com/issue/IJPL-228262). There is no global-settings fix in 2026.1.1 yet; star or vote on the issue to be notified when one ships ([how to follow YouTrack issues](https://youtrack.jetbrains.com/articles/SUPPORT-A-1737)).
0

Thanks for the info.  One other thing – you suggested above resetting the IDE to its default settings, and mentioned that a backup would be taken when I did that.  I need to get back to where I was before I did that – can you tell me where to find the backup?  Thanks.

0

When you use File | Manage IDE Settings | Restore Default Settings, the IDE saves a backup as a timestamped `.zip` file in your Configuration directory. The exact path depends on your OS:

Look for a file named something like `settings-backup-<date>.zip`. To restore, go to File | Manage IDE Settings | Import Settings and select that zip file.

0

Hi, Thanks for getting back to me.  I was kinda afraid of that.  It does look as though a folder was created with an appropriate date and timestamp in the name, but there are no files within that folder which match *settings*.zip.  I also tried working a few levels up the tree and looking from there downwards, but again no matches.  Unfortunately this presently leaves the IDE unaware of the locations of the projects I was working on, and refusing to build them once I've added them manually.  Anyway, thanks for the input – I appreciate it.

0

请先登录再写评论。