This commit adds a new PDLL specific LSP command, pdll.viewOutput, that allows for viewing the intermediate outputs of a given PDLL file. The available intermediate forms currently mirror those in mlir-pdll, namely: AST, MLIR, CPP. This is extremely useful for a developer of PDLL, as it simplifies various testing, and is also quite useful for users as they can easily view what is actually being generated for their PDLL files. This new command is added to the vscode client, and is available in the right client context menu of PDLL files, or via the vscode command palette. Differential Revision: https://reviews.llvm.org/D124783
26 lines
738 B
TypeScript
26 lines
738 B
TypeScript
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;
|
|
}
|