236 changes: 104 additions & 132 deletions mlir/utils/vscode/package-lock.json
60 changes: 34 additions & 26 deletions mlir/utils/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
{
"name": "mlir",
"name": "vscode-mlir",
"displayName": "MLIR",
"description": "MLIR Language Extension",
"version": "0.0.1",
"publisher": "llvm-vs-code-extensions",
"repository": "https://github.com/llvm/llvm-project/",
"homepage": "https://mlir.llvm.org/",
"icon": "icon.png",
"engines": {
"vscode": "^1.52.0"
},
"categories": [
"Programming Languages"
],
"keywords": [
"LLVM",
"MLIR"
],
"activationEvents": [
"onLanguage:mlir"
],
"main": "./out/extension",
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"format": "clang-format -i --glob=\"{src,test}/*.ts\"",
"package": "vsce package",
"publish": "vsce publish",
"git-clang-format": "git-clang-format"
},
"dependencies": {
"chokidar": "3.5.2",
"vscode-languageclient": "^5.2.1",
"vscode-languageserver-types": "3.16.0"
},
"devDependencies": {
"@types/mocha": "^5.2.0",
"@types/node": "^8.0.0",
"@types/vscode": "1.52.*",
"clang-format": "1.4.0",
"tslint": "^5.16.0",
"typescript": "^3.5.1",
"vsce": "^1.75.0",
"vscode-test": "^1.3.0"
},
"repository": {
"type": "git",
"url": "https://github.com/llvm-project/vscode-mlir.git"
},
"contributes": {
"languages": [
{
Expand Down Expand Up @@ -68,29 +100,5 @@
"title": "mlir: Restart language server"
}
]
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"format": "clang-format -i --glob=\"{src,test}/*.ts\"",
"test": "tsc -p ./ && node ./out/test/index.js",
"package": "vsce package"
},
"devDependencies": {
"@types/chokidar": "2.1.3",
"@types/mocha": "^5.2.0",
"@types/node": "^8.0.0",
"@types/vscode": "1.52.*",
"clang-format": "1.4.0",
"tslint": "^5.16.0",
"typescript": "^3.5.1",
"vsce": "^1.75.0",
"vscode-languageclient": "^5.2.1",
"vscode-test": "^1.3.0"
},
"dependencies": {
"chokidar": "3.5.2",
"vscode-languageclient": "^5.2.1",
"vscode-languageserver-types": "3.16.0"
}
}
7 changes: 5 additions & 2 deletions mlir/utils/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ 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);

// Initialize the commands of the extension.
context.subscriptions.push(
vscode.commands.registerCommand('mlir.restart', async () => {
mlirContext.dispose();
await mlirContext.activate();
await mlirContext.activate(outputChannel);
}));

mlirContext.activate();
mlirContext.activate(outputChannel);
}
5 changes: 3 additions & 2 deletions mlir/utils/vscode/src/mlirContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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.
Expand Down