1 import * as vscode from 'vscode';
2 import {MLIRContext} from './mlirContext';
5 * This class represents a base vscode command. It handles all of the necessary
6 * command registration and disposal boilerplate.
8 export abstract class Command extends vscode.Disposable {
9 private disposable: vscode.Disposable;
10 protected context: MLIRContext;
12 constructor(command: string, context: MLIRContext) {
13 super(() => this.dispose());
15 vscode.commands.registerCommand(command, this.execute, this);
16 this.context = context;
19 dispose() { this.disposable && this.disposable.dispose(); }
22 * The function executed when this command is invoked.
24 abstract execute(...args: any[]): any;