Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Eclipse: Formatierung von Kommentaren

10 views
Skip to first unread message

Peter Müller

unread,
May 10, 2023, 4:19:29 PM5/10/23
to
Wenn ich Kommentare mit Eclipse formatieren, verändert Eclipse den
Kommentar. So werden Sternchen in jeder Zeile hinzugefügt und
Zeilenumbrüche entfernt. Ich möchte, das Eclipse Kommentare nicht
anfässt. Wie kann ich das einstellen?


Michael Paap

unread,
May 10, 2023, 6:22:04 PM5/10/23
to
Window - Preferences - Java - Code Style - Formatter

Dort neues Profil erstellen, dann "Edit", Runterscrollen bis "Comments"
und da so anpassen, wie du es haben willst.

Gruß
Michael

Michael Paap

unread,
May 10, 2023, 6:22:04 PM5/10/23
to
Am 10.05.2023 um 22:19 schrieb Peter Müller:

Peter Müller

unread,
May 11, 2023, 5:25:34 AM5/11/23
to

>
> Window - Preferences - Java - Code Style - Formatter
>
> Dort neues Profil erstellen, dann "Edit", Runterscrollen bis "Comments"

So weit war ich auch schon. Aber welche Häkchen muss ich
selektieren/deselektieren?

Michael Paap

unread,
May 11, 2023, 6:03:24 AM5/11/23
to
Am 11.05.2023 um 11:23 schrieb Peter Müller:

> So weit war ich auch schon. Aber welche Häkchen muss ich
> selektieren/deselektieren?

Ich finde die eigentlich recht selbsterklärend.

Es gibt da z.B.:

[ ] Enable Javadoc comment formating
[ ] Enable block comment formating"
[ ] Enable line comment formating"

Wenn du die alle drei deaktivierst, sollte der Formatter deine
Kommentare nicht mehr anfassen. Bitte selbst testen...

Ansonsten gibt es noch ein paar andere Möglichkeiten:

1. Du packst umfangreiche Kommentare zwischen

// @formatter:off und // @formatter:on

2. Du beginnst Blockkommentar mit /*-

Dann fasst der Formatter diesen Kommentar nicht an.

Gruß
Michael Paap

Peter Müller

unread,
May 11, 2023, 5:05:53 PM5/11/23
to
Ich habe noch

[x] Preserve whitespace between code and line comments
[x] Never indent line comments on first column
[x] Never indent block comments on first column

gesetzt.
0 new messages