Skip to content

Commit 1421e42

Browse files
committed
fix(expand): position cursor at end of expanded class name
Fixes issue #55: after expanding a class name with the expand command, the cursor was repositioned to its original location instead of the end of the expanded FQCN, breaking the user's workflow. - Calculate cursor position from word range start + replacement length - Cursor now lands at the end of the expanded name
1 parent 024d365 commit 1421e42

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/core/ImportManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ export class ImportManager {
144144
textEdit.replace(wordRange, prefix + fqcn);
145145
});
146146

147-
const newPos = new vscode.Position(selection.active.line, selection.active.character);
147+
const endCol = wordRange.start.character + (prefix + fqcn).length;
148+
const newPos = new vscode.Position(wordRange.start.line, endCol);
148149
editor.selection = new vscode.Selection(newPos, newPos);
149150
}
150151

0 commit comments

Comments
 (0)