44 *--------------------------------------------------------------------------------------------*/
55
66'use strict' ;
7- import * as vscode from 'vscode' ;
7+ import { commands , ExtensionContext , window } from 'vscode' ;
88import { Config , configuration } from './util/config' ;
99import { constants } from './util/constants' ;
1010import { Logger } from './util/logger' ;
1111import { StatusBar } from './util/statusBar' ;
1212import { GCodeTreeProvider } from './providers/gcodeTree' ;
1313import { GCodeStatsProvider } from './providers/gcodeStats' ;
1414
15+
1516//import { GCodeHoverProvider } from './providers/gcodeHover';
1617//import { getColorization } from './colorization';
1718
1819
19- export async function activate ( context : vscode . ExtensionContext ) {
20+ export async function activate ( context : ExtensionContext ) {
2021
2122 const start = process . hrtime ( ) ;
2223
@@ -33,38 +34,39 @@ export async function activate(context: vscode.ExtensionContext) {
3334 // G-Code Tree View
3435 Logger . log ( "Loading Tree View..." ) ;
3536 const gcodeTree = new GCodeTreeProvider ( context ) ;
36- vscode . window . registerTreeDataProvider ( 'gcode.gcodeTree' , gcodeTree ) ;
37+ window . registerTreeDataProvider ( 'gcode.gcodeTree' , gcodeTree ) ;
3738
38- vscode . commands . registerCommand ( 'gcode.gcodeTree.refresh' , ( ) => {
39- if ( vscode . window . activeTextEditor ?. document . languageId === constants . langId ) {
40- vscode . commands . executeCommand ( 'setContext' , 'gcodeTreeViewEnabled' , true ) ;
39+ commands . registerCommand ( 'gcode.gcodeTree.refresh' , ( ) => {
40+ if ( window . activeTextEditor ?. document . languageId === constants . langId ) {
41+ commands . executeCommand ( 'setContext' , 'gcodeTreeViewEnabled' , true ) ;
4142 }
4243 gcodeTree . refresh ( ) ;
4344 } ) ;
44- vscode . commands . registerCommand ( 'gcode.gcodeTree.Selection' , range => gcodeTree . select ( range ) ) ;
45+ commands . registerCommand ( 'gcode.gcodeTree.Selection' , range => gcodeTree . select ( range ) ) ;
4546
4647
4748 Logger . log ( 'Tree AutoRefresh: ' + ( configuration . getParam ( 'treeAutoRefresh' ) ? 'Enabled' : 'Disabled' ) ) ;
4849
4950 // G-Code Stats View
5051 Logger . log ( "Loading Stats View..." ) ;
5152 const gcodeStats = new GCodeStatsProvider ( context ) ;
52- vscode . window . registerTreeDataProvider ( 'gcode.gcodeStats' , gcodeStats ) ;
53+ window . registerTreeDataProvider ( 'gcode.gcodeStats' , gcodeStats ) ;
5354
54- vscode . commands . registerCommand ( 'gcode.gcodeStats.refresh' , ( ) => {
55- if ( vscode . window . activeTextEditor ?. document . languageId === constants . langId ) {
56- vscode . commands . executeCommand ( 'setContext' , 'gcodeStatsViewEnabled' , true ) ;
55+ commands . registerCommand ( 'gcode.gcodeStats.refresh' , ( ) => {
56+ if ( window . activeTextEditor ?. document . languageId === constants . langId ) {
57+ commands . executeCommand ( 'setContext' , 'gcodeStatsViewEnabled' , true ) ;
5758 }
5859 gcodeStats . refresh ( ) ;
5960 } ) ;
60- vscode . commands . registerCommand ( 'gcode.gcodeStats.enable' , ( ) => {
61+ commands . registerCommand ( 'gcode.gcodeStats.enable' , ( ) => {
6162 Logger . log ( 'Enabling Stats...' ) ;
6263 configuration . setParam ( 'statsEnable' , true ) ;
6364
6465 }
6566 ) ;
6667
6768 Logger . log ( 'Stats: ' + ( configuration . getParam ( 'statsEnable' ) ? 'Enabled' : 'Disabled' ) ) ;
69+ Logger . log ( 'Stats AutoRefresh: ' + ( configuration . getParam ( 'statsAutoRefresh' ) ? 'Enabled' : 'Disabled' ) ) ;
6870
6971
7072 /*
0 commit comments