-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
@niteskum Can you provide a short description of the bugs that you are fixing? |
Bug Descriptions:
|
@@ -37,11 +37,11 @@ define(function(require, exports, module) { | |||
* Does the actual extraction. i.e Replacing the text, Creating a variable | |||
* and multi select variable names | |||
*/ | |||
function extract(scopes, parentStatement, expns, text) { | |||
function extract(scopes, parentStatement, expns, text, insertPostion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo insertPosition
@@ -63,6 +63,17 @@ define(function(require, exports, module) { | |||
expns[i].start = doc.adjustPosForChange(expns[i].start, varDeclaration.split("\n"), insertStartPos, insertStartPos); | |||
expns[i].end = doc.adjustPosForChange(expns[i].end, varDeclaration.split("\n"), insertStartPos, insertStartPos); | |||
|
|||
/* If there are multiple expressions . then second Expression onward |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adjusting the position for every replace, can you explore replacing backwards, so that the position need not be adjusted for every change. You can refer (and maybe use) this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boopeshmahendran We need to highlight all the replaced text also so replacing backwards, or "MultipleEdits" function won't help here
ping @nethip for review |
} | ||
for(var i = 0; i < refsArray.length; ++i) { | ||
var element = refsArray[i]; | ||
if((element.start.line === currentPosition.line || element.end.line === currentPosition.line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can use refsArray.find
.
current.editor.displayErrorMessageAtCursor(Strings.ERROR_GETTERS_SETTERS); | ||
return; | ||
} | ||
|
||
//Get Current Selected Property End Index; | ||
var propertyNodeArray = parentNode.properties; | ||
for(var i=0; i<propertyNodeArray.length; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also maybe you can use find
method
editor.setSelections(refs); | ||
} else { | ||
editor.setSelections(refs.filter(function(element) { | ||
var currentPosition = editor._codeMirror.posFromIndex(refsResp.offset), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use editor.posFromIndex
This PR includes Fix for JSRefactoring Bug which are reported in dreamweaver
ping @navch @sobisht @boopeshmahendran @raman211 for review