File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ export function incrementDecrement(delta: number): Thenable<boolean> {
2222
2323 return editor . edit ( editBuilder => {
2424 editor . selections . forEach ( selection => {
25- let rangeToReplace : vscode . Range = selection ;
26- if ( selection . isEmpty ) {
27- rangeToReplace = locate ( editor . document , selection . isReversed ? selection . anchor : selection . active ) ;
25+ let rangeToReplace = locate ( editor . document , selection . isReversed ? selection . anchor : selection . active ) ;
26+ if ( ! rangeToReplace ) {
27+ return ;
2828 }
2929
3030 const text = editor . document . getText ( rangeToReplace ) ;
@@ -67,7 +67,7 @@ export function update(numString, delta): string {
6767 * @param {Point } pos
6868 * @return {Range } Range of number or `undefined` if not found
6969 */
70- export function locate ( document : vscode . TextDocument , pos : vscode . Position ) {
70+ export function locate ( document : vscode . TextDocument , pos : vscode . Position ) : vscode . Range {
7171
7272 const line = document . lineAt ( pos . line ) . text ;
7373 let start = pos . character ;
You can’t perform that action at this time.
0 commit comments