I am trying to stop Eclipse changing the indentation of comments when using the formatter. e.g.
public class Test
{
public static void main(String[] args)
{
// comment 1
if (true != false &&
// comment 2
false != true)
{
}
}
}
Gets formatted to
public class Test
{
public static void main(String[] args)
{
// comment 1
if (true != false &&
// comment 2
false != true)
{
}
}
}
I don't want the formatter to move 'comment 2'
My eclipse formatter settings are:
I have tried unchecking the 'never indent' options as well.
Is there a way to get eclipse to stop doing this, or completely ignore lines that start with // ? This is a legacy codebase so I can't easily change the approach. Ideally I want to be able to format files on save so I don't want to use formatter on/off tags.
I am on Eclipse for Java developers version 2024-12 (4.34)