@@ -2,16 +2,11 @@ import { commands, ExtensionContext, window, workspace } from 'vscode';
22
33import { OxcCommands } from './commands' ;
44import { ConfigService } from './ConfigService' ;
5- import {
6- activate as activateLinter ,
7- deactivate as deactivateLinter ,
8- onConfigChange as onConfigChangeLinter ,
9- restartClient ,
10- toggleClient ,
11- } from './linter' ;
125import StatusBarItemHandler from './StatusBarItemHandler' ;
6+ import Linter from './tools/linter' ;
137
148const outputChannelName = 'Oxc' ;
9+ const linter = new Linter ( ) ;
1510
1611export async function activate ( context : ExtensionContext ) {
1712 const configService = new ConfigService ( ) ;
@@ -21,7 +16,7 @@ export async function activate(context: ExtensionContext) {
2116 } ) ;
2217
2318 const restartCommand = commands . registerCommand ( OxcCommands . RestartServer , async ( ) => {
24- await restartClient ( ) ;
19+ await linter . restartClient ( ) ;
2520 } ) ;
2621
2722 const showOutputCommand = commands . registerCommand ( OxcCommands . ShowOutputChannel , ( ) => {
@@ -31,7 +26,7 @@ export async function activate(context: ExtensionContext) {
3126 const toggleEnable = commands . registerCommand ( OxcCommands . ToggleEnable , async ( ) => {
3227 await configService . vsCodeConfig . updateEnable ( ! configService . vsCodeConfig . enable ) ;
3328
34- await toggleClient ( configService ) ;
29+ await linter . toggleClient ( configService ) ;
3530 } ) ;
3631
3732 const onDidChangeWorkspaceFoldersDispose = workspace . onDidChangeWorkspaceFolders ( async ( event ) => {
@@ -56,14 +51,14 @@ export async function activate(context: ExtensionContext) {
5651 ) ;
5752
5853 configService . onConfigChange = async function onConfigChange ( event ) {
59- await onConfigChangeLinter ( event , configService , statusBarItemHandler ) ;
54+ await linter . onConfigChange ( event , configService , statusBarItemHandler ) ;
6055 } ;
6156
62- await activateLinter ( context , outputChannel , configService , statusBarItemHandler ) ;
57+ await linter . activate ( context , outputChannel , configService , statusBarItemHandler ) ;
6358 // Show status bar item after activation
6459 statusBarItemHandler . show ( ) ;
6560}
6661
6762export async function deactivate ( ) : Promise < void > {
68- await deactivateLinter ( ) ;
63+ await linter . deactivate ( ) ;
6964}
0 commit comments