Skip to content

Commit

Permalink
Emmet: Locate number even when there is a selection Fixes #31281
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jul 23, 2017
1 parent ecdeaf3 commit 9b6cc9f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions extensions/emmet/src/incrementDecrement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export function incrementDecrement(delta: number): Thenable<boolean> {

return editor.edit(editBuilder => {
editor.selections.forEach(selection => {
let rangeToReplace: vscode.Range = selection;
if (selection.isEmpty) {
rangeToReplace = locate(editor.document, selection.isReversed ? selection.anchor : selection.active);
let rangeToReplace = locate(editor.document, selection.isReversed ? selection.anchor : selection.active);
if (!rangeToReplace) {
return;
}

const text = editor.document.getText(rangeToReplace);
Expand Down Expand Up @@ -67,7 +67,7 @@ export function update(numString, delta): string {
* @param {Point} pos
* @return {Range} Range of number or `undefined` if not found
*/
export function locate(document: vscode.TextDocument, pos: vscode.Position) {
export function locate(document: vscode.TextDocument, pos: vscode.Position): vscode.Range {

const line = document.lineAt(pos.line).text;
let start = pos.character;
Expand Down

0 comments on commit 9b6cc9f

Please sign in to comment.