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 234727 - Improve code template of for block
Summary: Improve code template of for block
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
: 246703 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-21 13:15 UTC by Vladimir Riha
Modified: 2014-08-29 06:04 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
patch (617 bytes, patch)
2014-06-02 14:27 UTC, Vladimir Riha
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2013-08-21 13:15:12 UTC
Current template generates global variable and could be more efficient if one wants to limit number of iterations by e.g. array length because the limit value is cached instead of being counted on each iteration


Proposed template:
for (var ${var default="i"} = 0, ${max} = 10; ${var} < ${max}; ${var}++) {
    ${selection}${cursor}
}

Generated result:
for (var i = 0, max = 10; i < max; i++) {
    
}
Comment 1 Vladimir Riha 2013-08-21 13:21:41 UTC
Should you agree, I can commit this simple change
Comment 2 Vladimir Riha 2014-06-02 14:27:27 UTC
Created attachment 147538 [details]
patch
Comment 3 Petr Pisl 2014-06-02 20:10:09 UTC
The patch is applied in web-main. Thanks for this.
Comment 4 Quality Engineering 2014-06-04 02:14:19 UTC
Integrated into 'main-silver', will be available in build *201406040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6a6d6d1a7064
User: Petr Pisl <ppisl@netbeans.org>
Log: #234727 - Improve code template of for block
Comment 5 Vladimir Riha 2014-06-09 11:27:26 UTC
thanks a lot, verified

Product Version: NetBeans IDE Dev (Build web-main-881-on-20140607)
Comment 6 Martin Fousek 2014-08-29 06:04:35 UTC
*** Bug 246703 has been marked as a duplicate of this bug. ***