30 lines · typescript
1import * as vscode from 'vscode';2 3import {registerMLIRExtensions} from './MLIR/mlir';4import {MLIRContext} from './mlirContext';5import {registerPDLLExtensions} from './PDLL/pdll';6 7/**8 * This method is called when the extension is activated. The extension is9 * activated the very first time a command is executed.10 */11export function activate(context: vscode.ExtensionContext) {12 const outputChannel = vscode.window.createOutputChannel('MLIR');13 context.subscriptions.push(outputChannel);14 15 const mlirContext = new MLIRContext();16 context.subscriptions.push(mlirContext);17 18 // Initialize the commands of the extension.19 context.subscriptions.push(20 vscode.commands.registerCommand('mlir.restart', async () => {21 // Dispose and reactivate the context.22 mlirContext.dispose();23 await mlirContext.activate(outputChannel);24 }));25 registerMLIRExtensions(context, mlirContext);26 registerPDLLExtensions(context, mlirContext);27 28 mlirContext.activate(outputChannel);29}30