Skip to content

Commit 673b8fe

Browse files
committed
release v0.3.3
1 parent b889acd commit 673b8fe

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "antd-design-token",
33
"displayName": "antd Design Token",
44
"description": "VSCode extension for antd v5 design token.",
5-
"version": "0.3.1",
5+
"version": "0.3.3",
66
"publisher": "shezhangzhang",
77
"engines": {
88
"vscode": "^1.68.0"

src/extension.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import setupAntdTokenCompletion from "./typing";
77
import { checkAntdProject } from "./utils";
88

99
export function activate(context: vscode.ExtensionContext) {
10-
const ACTIVE_KEY = "antd-design-token-active-key";
11-
const isActive = context.globalState.get(ACTIVE_KEY);
10+
let isActive = true;
1211
let disposeTyping: vscode.Disposable | undefined;
1312
let disposableAndClear: DisposableAndClear | undefined;
1413
let disposeEditor: vscode.Disposable | undefined;
@@ -20,19 +19,17 @@ export function activate(context: vscode.ExtensionContext) {
2019
const disposable = vscode.commands.registerCommand(
2120
"antd-design-token.toggle",
2221
() => {
23-
const isActive = context.globalState.get(ACTIVE_KEY);
24-
context.globalState.update(ACTIVE_KEY, !isActive);
22+
isActive = !isActive;
23+
disposeAll();
2524

2625
if (isActive) {
27-
disposeAll();
26+
setup();
2827
vscode.window.showInformationMessage(
29-
"antd design token is inactive now."
28+
"antd design token is active now."
3029
);
3130
} else {
32-
disposeEditor?.dispose();
33-
setup();
3431
vscode.window.showInformationMessage(
35-
"antd design token is active now."
32+
"antd design token is inactive now."
3633
);
3734
}
3835
}
@@ -77,6 +74,10 @@ export function activate(context: vscode.ExtensionContext) {
7774
disposableAndClear.clear();
7875
disposableAndClear = undefined;
7976
}
77+
78+
if (disposeEditor) {
79+
disposeEditor.dispose();
80+
}
8081
}
8182

8283
function activeEditorListener(fullToken: any) {

0 commit comments

Comments
 (0)