File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 11import { init , Mixpanel } from 'mixpanel' ;
22import * as os from 'os' ;
3- import vscode from 'vscode' ;
3+ import * as vscode from 'vscode' ;
44import { getMachineId } from './utils/machine-id-utils' ;
55import { v5 as uuidv5 } from 'uuid' ;
66import { 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
Original file line number Diff line number Diff 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 /**
You can’t perform that action at this time.
0 commit comments