1- import * as vscode from 'vscode' ;
2- import { ExtensionApp } from '../common/vscode/vscode-app' ;
1+ import { App , AppMode } from '../common/app' ;
32import { isCanary , isNewQueryRunExperienceEnabled } from '../config' ;
43import { logger } from '../logging' ;
54import { DisposableObject } from '../pure/disposable-object' ;
@@ -8,10 +7,8 @@ import { DbManager } from './db-manager';
87import { DbPanel } from './ui/db-panel' ;
98
109export class DbModule extends DisposableObject {
11- public async initialize (
12- extensionContext : vscode . ExtensionContext
13- ) : Promise < void > {
14- if ( extensionContext . extensionMode !== vscode . ExtensionMode . Development ||
10+ public async initialize ( app : App ) : Promise < void > {
11+ if ( app . mode !== AppMode . Development ||
1512 ! isCanary ( ) ||
1613 ! isNewQueryRunExperienceEnabled ( ) ) {
1714 // Currently, we only want to expose the new database panel when we
@@ -22,25 +19,20 @@ export class DbModule extends DisposableObject {
2219
2320 void logger . log ( 'Initializing database module' ) ;
2421
25- const app = new ExtensionApp ( extensionContext ) ;
26-
2722 const dbConfigStore = new DbConfigStore ( app ) ;
2823 await dbConfigStore . initialize ( ) ;
2924
3025 const dbManager = new DbManager ( dbConfigStore ) ;
3126 const dbPanel = new DbPanel ( dbManager ) ;
3227 await dbPanel . initialize ( ) ;
33- extensionContext . subscriptions . push ( dbPanel ) ;
3428
3529 this . push ( dbPanel ) ;
3630 this . push ( dbConfigStore ) ;
3731 }
3832}
3933
40- export async function initializeDbModule (
41- extensionContext : vscode . ExtensionContext
42- ) : Promise < DbModule > {
34+ export async function initializeDbModule ( app : App ) : Promise < DbModule > {
4335 const dbModule = new DbModule ( ) ;
44- await dbModule . initialize ( extensionContext ) ;
36+ await dbModule . initialize ( app ) ;
4537 return dbModule ;
4638}
0 commit comments