JSRefactoring Bugs Fix#14455
JSRefactoring Bugs Fix#14455boopeshmahendran merged 6 commits intoadobe:masterfrom niteskum:JSRefactorBugs
Conversation
|
@niteskum Can you provide a short description of the bugs that you are fixing? |
|
Bug Descriptions:
|
| * 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.
nit: typo insertPosition
| 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.
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.
@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.
Maybe you can use refsArray.find.
|
|
||
| //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.
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.
You can use editor.posFromIndex
This PR includes Fix for JSRefactoring Bug which are reported in dreamweaver
ping @navch @sobisht @boopeshmahendran @raman211 for review