This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 164601 - Code template expansion not possible without source reformatting
Summary: Code template expansion not possible without source reformatting
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-06 15:18 UTC by matthies
Modified: 2013-05-06 11:02 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2009-05-06 15:18:44 UTC
It seems that code template expansion automatically reformats the inserted code. This is undesirable if:

1) The automatic formatting is not adequate or not desired for the code that is being inserted. For example consider 
the code template

    if (${selection} == null) { throw new NullPointerException("${selection}"); }

intended to insert a single-line null test. The automatic formatting causes it to be reformatted into multiple lines 
upon insertion.

2) The code being inserted is incomplete partial code (to be completed manually after insertion) and because of this 
its syntax is wrongly interpreted when reformatting.

It would be good if one could specify for each code template whether reformatting should be applied or not.
Comment 1 Max Sauer 2009-05-11 16:22:26 UTC
Thanks for your ideas, this could be done in next release.
Comment 2 Jiri Prox 2013-05-06 11:02:06 UTC
This is already implemented,
use ${no-format} or ${no-indent} at the beginning of the template