mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-22 15:34:49 +01:00
fix: configuration proper scope, catch missing val
This commit is contained in:
parent
cc5bd6ea16
commit
bce44730b9
2 changed files with 32 additions and 25 deletions
16
package.json
16
package.json
|
@ -62,28 +62,26 @@
|
||||||
"title": "Hello World (debug)"
|
"title": "Hello World (debug)"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributes": {
|
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"title": "codemp",
|
"title": "codemp",
|
||||||
"properties": {
|
"properties": {
|
||||||
"typescript.server": {
|
"codemp.server": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "http://codemp.dev:50053",
|
"default": "http://codemp.dev:50053",
|
||||||
"description": "Server address to connect to"
|
"description": "Server address to connect to"
|
||||||
},
|
},
|
||||||
"typescript.username": {
|
"codemp.username": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "mail@example.net",
|
"default": "",
|
||||||
"description": "Username to use for login (the email you used during registration)"
|
"description": "Username to use for login (the email you used during registration)"
|
||||||
},
|
},
|
||||||
"typescript.password": {
|
"codemp.password": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "dont-use-this-password",
|
"default": "",
|
||||||
"description": "Password to use for login"
|
"description": "Password to use for login"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run compile",
|
||||||
|
@ -102,6 +100,7 @@
|
||||||
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
||||||
"@typescript-eslint/parser": "^6.4.1",
|
"@typescript-eslint/parser": "^6.4.1",
|
||||||
"@vscode/test-electron": "^2.3.4",
|
"@vscode/test-electron": "^2.3.4",
|
||||||
|
"@vscode/vsce": "^3.1.0",
|
||||||
"eslint": "^8.47.0",
|
"eslint": "^8.47.0",
|
||||||
"glob": "^10.3.3",
|
"glob": "^10.3.3",
|
||||||
"mocha": "^10.2.0",
|
"mocha": "^10.2.0",
|
||||||
|
@ -109,7 +108,6 @@
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"codemp": "^0.0.5",
|
"codemp": "^0.0.5"
|
||||||
"vsce": "^2.15.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,19 @@ let workspace: codemp.Workspace | null = null;
|
||||||
let mine : boolean;
|
let mine : boolean;
|
||||||
|
|
||||||
export async function connect() {
|
export async function connect() {
|
||||||
let config = vscode.workspace.getConfiguration('codemp-vscode');
|
let config = vscode.workspace.getConfiguration('codemp');
|
||||||
let server : string = config.get("server", "http://codemp.dev:50053");
|
let server = config.get<string>("server", "http://codemp.dev:50053");
|
||||||
let username : string = config.get("username")!;
|
|
||||||
let password : string = config.get("password")!;
|
let username = config.get<string>("username");
|
||||||
|
if (!username) {
|
||||||
|
return vscode.window.showErrorMessage("missing username in settings: configure it first!");
|
||||||
|
}
|
||||||
|
|
||||||
|
let password = config.get<string>("password");
|
||||||
|
if (!password) {
|
||||||
|
return vscode.window.showErrorMessage("missing password in settings: configure it first!");
|
||||||
|
}
|
||||||
|
|
||||||
client = await codemp.connect(server, username, password);
|
client = await codemp.connect(server, username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue