Hello, problem solved, with one surprise:
I didn't realize that the expansion of code templates is limited to locations
where the expansion would create correct code, so some of my tests (that led me
to believe I had a problem) were invalid. I never discovered this because
(apparently) I never used "sout"+tab except where it would create legal code.
Most tests I now make follow this idea. The counter examples are
for (int i = 0; i < 5; i++) { <> }
in which replacing "<>" with "sout" + tab produces "System.out.println("");",
exactly as expected.
However, in
or (int i = 0; i < 5; i++) <>
replacing "<>" with "sout" + tab produces "sout" and a tab's worth of spaces. A
for-each loop to traverse an ArrayList behaves exactly the same. OTOH an "if"
statement doesn't share this property, nor does a "while" loop.
It is curious that the "for" loops will only expand the template if their
controlled blocks are surrounded with curly braces. I have duplicated the
problem after restarting NB and/or reboot.โCaveat: I have not tested this
situation on more than 2 projects. I use NetBeans 16 running on Windows 10.
Chris Lanz
340 Dunn Hall, SUNY Potsdam
[email protected]
315 268 1547
________________________________
From: Laszlo Kishalmi <[email protected]>
Sent: Saturday, January 14, 2023 10:58 AM
To: [email protected] <[email protected]>
Subject: Re: [EXTERNAL] Re: NB 16 code template expansion
This feature is enabled by default. Cannot be really switched off. (Disablind
it support modules might work).
In Tools > Options > Editor > Code Templates at the bottom of the dialog, the
action key <Tab> (by default) can be changed though.
If I remember well there was a time when tha expand action was simply the
<space> key.
On 1/14/23 07:47, Christopher C. Lanz wrote:
Hello,
I have been using tab to expand "sout" to System.out.println(""); for several
years. Since I have never used Eclipse/IntelliJ-IDEA, it would be difficult for
me to have them confused with NB.
As yet noone has responded to the question of how that feature gets toggled.
Chris Lanz, Assoc. Professor Emeritus
Department of Computer Science
340 Dunn Hall, SUNY Potsdam
[email protected]<mailto:[email protected]>
315 268 1547
________________________________
From: Sean Carrick <[email protected]><mailto:[email protected]>
Sent: Friday, January 13, 2023 3:34 PM
To: Christopher C. Lanz
<[email protected]><mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>
<[email protected]><mailto:[email protected]>
Subject: [EXTERNAL] Re: NB 16 code template expansion
This message did not originate from SUNY Potsdam or one of its trusted senders.
Do not open attachments, click on links, or provide your credentials if the
source is suspicious.
Chris,
I cannot recall a time when TAB expanded anything in NB...Did you mean "sout" +
CTRL+SPACE? Because that is how I remember it always working and how it
currently works. Is it possible that you are confusing the template expansion
from Eclipse/IntelliJ-IDEA and NB? ๐ That's why I try not to switch IDEs very
often...๐
Sincerely,
Sean Carrick
Owner - PekinSOFT Systems
[email protected]<mailto:[email protected]>
(309) 989-0672
On Thu, Jan 12, 2023 at 9:24 AM Christopher C. Lanz
<[email protected]><mailto:[email protected]> wrote:
Hello, in messing around about other problems, I seem to have disabled code
template expansion. (Typing "sout" +tab always used to produce
"System.out.println("");" I can't find a Tools/Options setting that turns this
feature back on. The Apache page
https://netbeans.apache.org/kb/docs/php/code-templates.html
doesn't include this information, and I couldn't find a post that provides it.
???
Thanks
Chris Lanz
340 Dunn Hall, SUNY Potsdam
[email protected]<mailto:[email protected]>
315 268 1547