Only return cursor to editor when selection succeeds

This commit is contained in:
John 2022-05-05 22:06:24 -05:00
parent 7c985b3817
commit 7e001ee50c

View File

@ -231,12 +231,13 @@ function selectLeadingWhitespace(): void {
(numSpaces !== 1) (numSpaces !== 1)
? window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces selected`) ? window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces selected`)
: window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space selected`); : window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space selected`);
// Move the cursor to the new selection
window.showTextDocument(editor.document);
} }
else { else {
window.showErrorMessage(`Line ${lineNum.toString()}: No leading spaces to select!`); // No whitespace to select window.showErrorMessage(`Line ${lineNum.toString()}: No leading spaces to select!`); // No whitespace to select
} }
// Move the cursor to the new selection
window.showTextDocument(editor.document);
} }
else { else {
window.showErrorMessage('No document currently active'); // No active document window.showErrorMessage('No document currently active'); // No active document