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

Summary: Code template expansion not possible without source reformatting
Product: java Reporter: matthies <matthies>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: RESOLVED WORKSFORME    
Severity: blocker CC: rahuijts
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: ENHANCEMENT Exception Reporter:

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