Skip to content

Commit

Permalink
perf: do nothing after clicking esc
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji committed Nov 11, 2024
1 parent 786356c commit 5598c69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"scripts": {
"clean": "rimraf node_modules dist *.vsix",
"postinstall": "simple-git-hooks",
"package": "rimraf *.vsix && pnpm vsce package --no-dependencies",
"package": "rimraf *.vsix && pnpm build && pnpm vsce package --no-dependencies",
"release": "vr release --skip-npm-publish",
"lint": "eslint src --fix",
"format": "prettier . --write",
Expand Down
18 changes: 14 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
NO_ANY_ALIAS,
SYSTEM_ALIAS,
} from './constants';
import { isEmpty, isNonEmptyArray } from 'rattail';
import { isNonEmptyArray } from 'rattail';
import { getAliasName } from './utils';
import { Alias } from './types';
import storePath from './path';
Expand Down Expand Up @@ -74,10 +74,15 @@ class AliasView implements vscode.TreeDataProvider<AliasItem> {
async addAlias() {
const alias = await vscode.window.showInputBox({
placeHolder: CREATE_ALIAS_PLACEHOLDER,
value: '',
value: undefined,
});

if (isEmpty(alias)) {
// cancel input alias
if (alias === undefined) {
return;
}

if (!alias.length) {
vscode.window.showErrorMessage(ALIAS_IS_NOT_EMPTY);
return;
}
Expand Down Expand Up @@ -122,7 +127,12 @@ class AliasView implements vscode.TreeDataProvider<AliasItem> {
value: alias.data.value,
});

if (isEmpty(command)) {
// cancel input command
if (command === undefined) {
return;
}

if (!command.length) {
vscode.window.showErrorMessage(ALIAS_IS_NOT_EMPTY);
return;
}
Expand Down

0 comments on commit 5598c69

Please sign in to comment.