* When expanding abbreviations, do so from bottom to top.  This way a change higher up will not interfere with text below.

* When expanding abbreviations, do so from bottom to top.  This way a change higher up will not interfere with text below.
This commit is contained in:
jmdowns2
2017-10-12 13:26:55 -04:00
committed by Ramya Rao
parent fcf92f6bc3
commit 49e570e136
+8 -1
View File
@@ -139,7 +139,14 @@ export function expandEmmetAbbreviation(args): Thenable<boolean> {
return [new vscode.Range(abbreviationRange.start.line, abbreviationRange.start.character, abbreviationRange.end.line, abbreviationRange.end.character), abbreviation, filter];
};
editor.selections.forEach(selection => {
let selectionsInReverseOrder = editor.selections.slice(0);
selectionsInReverseOrder.sort((a, b) => {
var posA = a.isReversed ? a.anchor : a.active;
var posB = b.isReversed ? b.anchor : b.active;
return posA.compareTo(posB) * -1;
});
selectionsInReverseOrder.forEach(selection => {
let position = selection.isReversed ? selection.anchor : selection.active;
let [rangeToReplace, abbreviation, filter] = getAbbreviation(editor.document, selection, position, syntax);
if (!rangeToReplace) {