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 233581

Summary: [Javascript] Please add 'Introduce Method' refactoring
Product: javascript Reporter: tomzi <tomzi>
Component: RefactoringAssignee: Petr Pisl <ppisl>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description tomzi 2013-07-29 10:31:21 UTC
If you are used to refactorings in Java, then you really don't want to miss it in Javascript as well :)

Product Version = NetBeans IDE 7.4 Beta (Build 201307092200)
Operating System = Linux version 3.8.0-26-generic running on amd64
Java; VM; Vendor = 1.7.0_25
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Comment 1 elennaro 2015-02-28 11:19:30 UTC
We can split/divide this task to steps.

At first it'd be great to have move to a function method which (exactely like in java) will allow you to:
1) mark piece of code
2) choose Refactoring -> move to a funtion
3) In menu appeared we must be able to:
 3.a) choose in which scope to put this newly created function, eg global or current function's one 
 3.b) choose what type of function do we want to create: anonymous (e.g. var myCreatedFunction = function (p1, p2){etc}) or plain (function myCreatedFuction(p1, p2))
 3.c) Choose the name of the function
 3.d) Choose (like in java) for other appearance of code

Next steps for more great JS refactoring can be considered based on Learning JavaScript Design Patterns book (