mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-10 03:13:34 +00:00
[mlir-vscode] Create a proper output channel for the MLIRContext
This allows for reusing the same output channel when the extension reloads after updating the server. Currently, whenever the extension restarts a new output channel is created (which can lead to a large number of seemingly dead output channels).
This commit is contained in:
parent
3e5906499f
commit
03b2d1a659
@ -7,6 +7,9 @@ import {MLIRContext} from './mlirContext';
|
||||
* activated the very first time a command is executed.
|
||||
*/
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
const outputChannel = vscode.window.createOutputChannel('MLIR');
|
||||
context.subscriptions.push(outputChannel);
|
||||
|
||||
const mlirContext = new MLIRContext();
|
||||
context.subscriptions.push(mlirContext);
|
||||
|
||||
@ -14,8 +17,8 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('mlir.restart', async () => {
|
||||
mlirContext.dispose();
|
||||
await mlirContext.activate();
|
||||
await mlirContext.activate(outputChannel);
|
||||
}));
|
||||
|
||||
mlirContext.activate();
|
||||
mlirContext.activate(outputChannel);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ export class MLIRContext implements vscode.Disposable {
|
||||
/**
|
||||
* Activate the MLIR context, and start the language client.
|
||||
*/
|
||||
async activate() {
|
||||
async activate(outputChannel: vscode.OutputChannel) {
|
||||
// Get the path of the mlir-lsp-server that is used to provide language
|
||||
// functionality.
|
||||
const userDefinedServerPath = config.get<string>('server_path');
|
||||
@ -43,7 +43,8 @@ export class MLIRContext implements vscode.Disposable {
|
||||
// Notify the server about file changes to *.mlir files contained in the
|
||||
// workspace.
|
||||
fileEvents : vscode.workspace.createFileSystemWatcher('**/*.mlir')
|
||||
}
|
||||
},
|
||||
outputChannel : outputChannel,
|
||||
};
|
||||
|
||||
// Create the language client and start the client.
|
||||
|
Loading…
x
Reference in New Issue
Block a user