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