提交 9b6cc9f7 编写于 作者: R Ramya Achutha Rao

Emmet: Locate number even when there is a selection Fixes #31281

上级 ecdeaf3f
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册