Improve secretStorage usage and pipx installation

- Add await keyword to secretStorage.store call in extension.ts.
- Set statusBarItem.command to undefined instead of an empty string.
- Force pipx installation in install.py by adding --force flag.
This commit is contained in:
bobo.yang 2023-05-28 09:58:53 +08:00
parent 88b16d53c3
commit a9fa1c7abb
2 changed files with 3 additions and 3 deletions

View File

@ -177,7 +177,7 @@ function activate(context: vscode.ExtensionContext) {
const versionOld = await secretStorage.get("devchat_version_old");
const versionNew = extensionVersion;
const versionChanged = versionOld !== versionNew;
secretStorage.store("devchat_version_old", versionNew!);
await secretStorage.store("devchat_version_old", versionNew!);
// status item has three status type
// 1. not in a folder
@ -217,7 +217,7 @@ function activate(context: vscode.ExtensionContext) {
if (devchatStatus !== 'ready') {
statusBarItem.text = `$(warning)DevChat`;
statusBarItem.tooltip = `${devchatStatus}`;
statusBarItem.command = '';
statusBarItem.command = undefined;
// set statusBarItem warning color
return;
}

View File

@ -12,7 +12,7 @@ def check_pipx_installed():
def install_pipx():
print("Installing pipx...")
try:
subprocess.run(["python3", "-m", "pip", "install", "pipx"], check=True)
subprocess.run(["python3", "-m", "pip", "install", "pipx", "--force"], check=True)
print("pipx installed successfully.")
except subprocess.CalledProcessError as e:
print("Error installing pipx:", e, file=sys.stderr)