Skip to content

Commit dc4aee9

Browse files
committed
fix comments
1 parent dd7ad75 commit dc4aee9

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

packages/schema/src/vscode-telemetry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { init, Mixpanel } from 'mixpanel';
22
import * as os from 'os';
3-
import vscode from 'vscode';
3+
import * as vscode from 'vscode';
44
import { getMachineId } from './utils/machine-id-utils';
55
import { v5 as uuidv5 } from 'uuid';
66
import { TELEMETRY_TRACKING_TOKEN } from './constants';
@@ -36,6 +36,7 @@ export class VSCodeTelemetry {
3636

3737
private getDeviceId() {
3838
const hostId = getMachineId();
39+
// namespace UUID for generating UUIDv5 from DNS 'zenstack.dev'
3940
return uuidv5(hostId, '133cac15-3efb-50fa-b5fc-4b90e441e563');
4041
}
4142

packages/schema/src/zmodel-preview.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,18 @@ export class ZModelPreview implements vscode.Disposable {
5050
initialize(context: vscode.ExtensionContext): void {
5151
this.registerCommands(context);
5252

53-
vscode.window.tabGroups.onDidChangeTabs(() => {
54-
const activeTabLabels = vscode.window.tabGroups.all.filter((group) =>
55-
group.activeTab?.label?.endsWith(this.previewZModelFileName)
56-
);
57-
if (activeTabLabels.length > 0) {
58-
vscode.commands.executeCommand('setContext', 'zenstack.isMarkdownPreview', true);
59-
} else {
60-
vscode.commands.executeCommand('setContext', 'zenstack.isMarkdownPreview', false);
61-
}
62-
});
53+
context.subscriptions.push(
54+
vscode.window.tabGroups.onDidChangeTabs(() => {
55+
const activeTabLabels = vscode.window.tabGroups.all.filter((group) =>
56+
group.activeTab?.label?.endsWith(this.previewZModelFileName)
57+
);
58+
if (activeTabLabels.length > 0) {
59+
vscode.commands.executeCommand('setContext', 'zenstack.isMarkdownPreview', true);
60+
} else {
61+
vscode.commands.executeCommand('setContext', 'zenstack.isMarkdownPreview', false);
62+
}
63+
})
64+
);
6365
}
6466

6567
/**

0 commit comments

Comments
 (0)