You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by "Tellis, Wyatt" <Wy...@ucsf.edu.INVALID> on 2022/10/06 14:48:34 UTC

Formatting issue

I've noticed that with NB 15 the formatting of try with resources lines is broken.  NB insists on putting everything on one line.  For example if I have:

try (Resource r1 = getResource();
     Resource r2 = getResource()) {

}

NB will put everything on one line when formatting the code:

try (Resource r1 = getResource(); Resource r2 = getResource()) {

}


This never happened with NB 12 and prior versions.  I've tried toggling Multiline Alignment, but it doesn't do anything.  Is there another setting that controls this behavior?

Wyatt

RE: Formatting issue

Posted by "Tellis, Wyatt" <Wy...@ucsf.edu.INVALID>.
> Well, you can try setting Always wrap for Try Resources in the formatting options - Language : Java, Category: Wrapping.

Thanks, that fixed it.

> The underlying problem is actually in javac, and afaik fixed in JDK 20.

Just curious, how does javac lead to this problem?

-----Original Message-----
From: Neil C Smith <ne...@apache.org> 
Sent: Thursday, October 6, 2022 8:03 AM
To: Tellis, Wyatt <Wy...@ucsf.edu>
Cc: users@netbeans.apache.org
Subject: Re: Formatting issue

On Thu, 6 Oct 2022 at 15:49, Tellis, Wyatt
<Wy...@ucsf.edu.invalid> wrote:
> This never happened with NB 12 and prior versions.  I’ve tried toggling Multiline Alignment, but it doesn’t do anything.  Is there another setting that controls this behavior?

Well, you can try setting Always wrap for Try Resources in the
formatting options - Language : Java, Category: Wrapping.

While fixing the additional leading space I tried to fix the line
break removal too, but although I know where it's triggered I couldn't
find a workaround.  The underlying problem is actually in javac, and
afaik fixed in JDK 20.

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://urldefense.com/v3/__https://cwiki.apache.org/confluence/display/NETBEANS/Mailing*lists__;Kw!!LQC6Cpwp!oYXBdhehC4Gd1XxOrMkphYeGBAEO9eoIdTD1bUTwEAfUtiFqCDQdj3LK-ynw7ESpHGGa-Bq_PHfMMAOzSCyg8RAJ$  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: Formatting issue

Posted by Neil C Smith <ne...@apache.org>.
On Thu, 6 Oct 2022 at 15:49, Tellis, Wyatt
<Wy...@ucsf.edu.invalid> wrote:
> This never happened with NB 12 and prior versions.  I’ve tried toggling Multiline Alignment, but it doesn’t do anything.  Is there another setting that controls this behavior?

Well, you can try setting Always wrap for Try Resources in the
formatting options - Language : Java, Category: Wrapping.

While fixing the additional leading space I tried to fix the line
break removal too, but although I know where it's triggered I couldn't
find a workaround.  The underlying problem is actually in javac, and
afaik fixed in JDK 20.

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists