mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 16:49:06 +01:00
Emmet: Locate number even when there is a selection Fixes #31281
This commit is contained in:
@@ -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);
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user