fix: correctly declare extension

This commit is contained in:
əlemi 2023-07-03 01:38:09 +02:00
parent 9584707982
commit e2176fd1fc
2 changed files with 15 additions and 14 deletions

View file

@ -1,8 +1,8 @@
{ {
"name": "codemp-vscode", "name": "codemp",
"version": "0.0.1", "version": "0.0.1",
"description": "VSCode extension for CodeMP", "description": "VSCode extension for CodeMP",
"main": "index.node", "main": "./out/extension.js",
"engines": { "engines": {
"vscode": "^1.32.0" "vscode": "^1.32.0"
}, },
@ -17,12 +17,12 @@
"contributes": { "contributes": {
"commands": [ "commands": [
{ {
"command": "example.helloWorld", "command": "codemp.connect",
"title": "Hello World" "title": "Connect"
} }
] ]
}, },
"activationEvents": [ "activationEvents": [
"onCommand:example.helloWorld" "onCommand:codemp.connect"
] ]
} }

View file

@ -1,19 +1,20 @@
const vscode = require("vscode"); const vscode = require("vscode");
const codemp = require("./codemp.node");
module.exports = { var CLIENT = null
activate,
deactivate,
};
function activate(context) { async function activate(context) {
// This must match the command property in the package.json // This must match the command property in the package.json
const commandID = "codemp.connect"; const commandID = "codemp.connect";
let disposable = vscode.commands.registerCommand(commandID, sayHello); let disposable = vscode.commands.registerCommand(commandID, connect);
context.subscriptions.push(disposable); context.subscriptions.push(disposable);
} }
function connect() { async function connect() {
vscode.window.showInformationMessage("Connecting to CodeMP!"); CLIENT = await codemp.connect("http://fantabos.co:50051")
vscode.window.showInformationMessage("Connected to CodeMP!");
} }
function deactivate() {} module.exports = {
activate,
}