@@ -13,7 +13,7 @@ import { NavTreeView } from './views/navTreeView';
1313import { GCodeUnitsController } from './gcodeUnits' ;
1414import { StatsView } from './views/statsView' ;
1515import { constants , Contexts , PIcon , VSBuiltInCommands } from './util/constants' ;
16- import { Commands } from './util/commands' ;
16+ import { UtilCommands } from './util/commands/common ' ;
1717import { Version } from './util/version' ;
1818import { Messages } from './util/messages' ;
1919import { StateControl } from './util/stateControl' ;
@@ -32,6 +32,33 @@ export class Control {
3232 private static _statsView : StatsView | undefined ;
3333 private static _navTree : NavTreeView | undefined ;
3434
35+ private static async checkVersion ( ) {
36+ const gcodeVersion = new Version ( constants . extension . version ) ;
37+
38+ const prevVer = this . _stateController . getVersion ( ) ;
39+
40+ const newVer = gcodeVersion . compareWith ( prevVer . getVersion ( ) ) === 1 ? true : false ;
41+
42+ if ( newVer ) {
43+ // Extension has been updated
44+
45+ // Update globalState version
46+ Logger . log ( 'Updating...' ) ;
47+ void this . _stateController . updateVer ( gcodeVersion ) ;
48+
49+ Logger . log ( `G-Code upgraded from ${ prevVer . getVersionAsString ( ) } to ${ gcodeVersion . getVersionAsString ( ) } ` ) ;
50+ await this . showWhatsNew ( gcodeVersion ) ;
51+ } else {
52+ return ;
53+ }
54+ }
55+
56+ private static async showWhatsNew ( ver : Version ) {
57+ // Show Whats New Message
58+ await Messages . showWhatsNewMessage ( ver ) ;
59+ }
60+
61+ // Static Methods
3562 static initialize ( context : ExtensionContext , config : Config ) {
3663 this . _context = context ;
3764 this . _config = config ;
@@ -99,7 +126,7 @@ export class Control {
99126 'support' ,
100127 'Support G-Code Syntax ❤' ,
101128 undefined ,
102- Commands . GCSUPPORT ,
129+ UtilCommands . ShowSupportGCode ,
103130 ) ;
104131
105132 // Check Version
@@ -118,32 +145,6 @@ export class Control {
118145 return secs * 1000 + nanosecs / 1000000 ;
119146 }
120147
121- private static async checkVersion ( ) {
122- const gcodeVersion = new Version ( constants . extension . version ) ;
123-
124- const prevVer = this . _stateController . getVersion ( ) ;
125-
126- const newVer = gcodeVersion . compareWith ( prevVer . getVersion ( ) ) === 1 ? true : false ;
127-
128- if ( newVer ) {
129- // Extension has been updated
130-
131- // Update globalState version
132- Logger . log ( 'Updating...' ) ;
133- void this . _stateController . updateVer ( gcodeVersion ) ;
134-
135- Logger . log ( `G-Code upgraded from ${ prevVer . getVersionAsString ( ) } to ${ gcodeVersion . getVersionAsString ( ) } ` ) ;
136- await this . showWhatsNew ( gcodeVersion ) ;
137- } else {
138- return ;
139- }
140- }
141-
142- private static async showWhatsNew ( ver : Version ) {
143- // Show Whats New Message
144- await Messages . showWhatsNewMessage ( ver ) ;
145- }
146-
147148 static setContext ( key : Contexts | string , value : any ) {
148149 return commands . executeCommand ( VSBuiltInCommands . SetContext , key , value ) ;
149150 }
0 commit comments