Skip to content

Commit

Permalink
Fix for #32342 (#35463)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jmdowns2 authored and sandy081 committed Oct 16, 2017
1 parent 0fcfc93 commit 0d2505f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion extensions/emmet/src/abbreviationActions.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit 0d2505f

Please sign in to comment.