From e2176fd1fc6454b78f26c0eb9da886e2e679e608 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 3 Jul 2023 01:38:09 +0200 Subject: [PATCH] fix: correctly declare extension --- client/vscode/package.json | 10 +++++----- client/vscode/src/extension.js | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/client/vscode/package.json b/client/vscode/package.json index 53e6801..a31a73d 100644 --- a/client/vscode/package.json +++ b/client/vscode/package.json @@ -1,8 +1,8 @@ { - "name": "codemp-vscode", + "name": "codemp", "version": "0.0.1", "description": "VSCode extension for CodeMP", - "main": "index.node", + "main": "./out/extension.js", "engines": { "vscode": "^1.32.0" }, @@ -17,12 +17,12 @@ "contributes": { "commands": [ { - "command": "example.helloWorld", - "title": "Hello World" + "command": "codemp.connect", + "title": "Connect" } ] }, "activationEvents": [ - "onCommand:example.helloWorld" + "onCommand:codemp.connect" ] } diff --git a/client/vscode/src/extension.js b/client/vscode/src/extension.js index df5b991..27a6217 100644 --- a/client/vscode/src/extension.js +++ b/client/vscode/src/extension.js @@ -1,19 +1,20 @@ const vscode = require("vscode"); +const codemp = require("./codemp.node"); -module.exports = { - activate, - deactivate, -}; +var CLIENT = null -function activate(context) { +async function activate(context) { // This must match the command property in the package.json const commandID = "codemp.connect"; - let disposable = vscode.commands.registerCommand(commandID, sayHello); + let disposable = vscode.commands.registerCommand(commandID, connect); context.subscriptions.push(disposable); } -function connect() { - vscode.window.showInformationMessage("Connecting to CodeMP!"); +async function connect() { + CLIENT = await codemp.connect("http://fantabos.co:50051") + vscode.window.showInformationMessage("Connected to CodeMP!"); } -function deactivate() {} +module.exports = { + activate, +}