import * as vscode from "vscode" ; import { WLNotebookSerializer } from "./serializer" ; import { WLNotebookController } from "./controller" ; import { setWLSymbolData , wlCompletionProvider , wlHoverProvider } from "./language" ; import { readFileSync } from "fs" ; export function activate ( context ) { context . subscriptions . push ( vscode . workspace . registerNotebookSerializer ( "wolfram-language-notebook" , new WLNotebookSerializer ( ) ) ) ; const notebookController = new WLNotebookController ( ) ; context . subscriptions . push ( notebookController . getController ( ) ) ; context . subscriptions . push ( vscode . commands . registerCommand ( "wolframLanguageNotebook.manageKernels" , ( ) => { notebookController . manageKernel ( ) ; } ) ) ; context . subscriptions . push ( vscode . commands . registerCommand ( "wolframLanguageNotebook.newNotebook" , async ( ) => { const newNotebook = await vscode . workspace . openNotebookDocument ( "wolfram-language-notebook" , { cells : [ ] } ) ; await vscode . commands . executeCommand ( 'vscode.open' , newNotebook . uri ) ; } ) ) ; context . subscriptions . push ( vscode . commands . registerCommand ( "wolframLanguageNotebook.openConfigurations" , ( ) => { vscode . commands . executeCommand ( "workbench.action.openSettings" , "wolframLanguageNotebook" ) ; } ) ) ; context . subscriptions . push ( vscode . commands . registerCommand ( "wolframLanguageNotebook.exportAs" , ( e ) => { const activeUri = e ?. notebookEditor ?. notebookUri ; if ( activeUri ) { notebookController . exportNotebook ( activeUri ) ; } } ) ) ; setWLSymbolData ( readFileSync ( context . extensionPath + "/resources/wl-symbol-usages.txt" ) . toString ( ) ) ; context . subscriptions . push ( vscode . languages . registerCompletionItemProvider ( "wolfram" , wlCompletionProvider ) ) ; context . subscriptions . push ( vscode . languages . registerHoverProvider ( "wolfram" , wlHoverProvider ) ) ; } export function deactivate ( ) { }