import * as vscode from 'vscode';
import { DepNodeProvider } from './deadlockPanel';
import BriefingView, { BRIEFING_ID } from './view/briefingView';
import HelpView, { HELP_ID } from './view/helpView';
import View from './view/view';
import { OPEN_BRIEFING_COMMAND, OPEN_HELP_COMMAND } from './command';

export function initViews(extensionPath: string) {
  new BriefingView(extensionPath);
  new HelpView(extensionPath);
}


export function activate(context: vscode.ExtensionContext) {

  initViews(context.extensionPath);

  // @ts-ignore
  const deadlockPanelProvider = new DepNodeProvider(vscode.workspace.rootPath);
  vscode.window.registerTreeDataProvider('deadlockPanel', deadlockPanelProvider);

  context.subscriptions.push(
    vscode.commands.registerCommand(OPEN_BRIEFING_COMMAND.command, () => {
      View.getView(BRIEFING_ID).createOrShow();
    })
  );
  context.subscriptions.push(
    vscode.commands.registerCommand(OPEN_HELP_COMMAND.command, () => {
      View.getView(HELP_ID).createOrShow();
    })
  );

}