better configuration enum items

This commit is contained in:
vsrs 2020-04-29 14:13:57 +03:00
parent 042917e6e3
commit 9153e96e88
3 changed files with 16 additions and 13 deletions

View File

@ -390,22 +390,25 @@
"default": false
},
"rust-analyzer.debug.engine": {
"type": [
"null",
"string"
],
"type": "string",
"enum": [
"ms-vscode.cpptools",
"vadimcn.vscode-lldb"
"auto",
"vadimcn.vscode-lldb",
"ms-vscode.cpptools"
],
"default": null,
"description": "Preffered debug engine."
"default": "auto",
"description": "Preffered debug engine.",
"markdownEnumDescriptions": [
"First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).",
"Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)",
"Use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)"
]
},
"rust-analyzer.debug.sourceFileMap" : {
"type":"object",
"rust-analyzer.debug.sourceFileMap": {
"type": "object",
"description": "Optional source file mappings passed to the debug engine.",
"default": {
"<source-path>": "<target-path>"
"/rustc/<id>": "${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/lib/rustlib/src/rust"
}
}
}

View File

@ -102,7 +102,7 @@ export function debugSingle(ctx: Ctx): Cmd {
let debugEngineId = ctx.config.debug.engine;
let debugEngine = null;
if (!debugEngineId) {
if ( debugEngineId === "auto" ) {
debugEngine = vscode.extensions.getExtension(lldbId);
if (!debugEngine) {
debugEngine = vscode.extensions.getExtension(cpptoolsId);

View File

@ -109,7 +109,7 @@ export class Config {
get debug() {
return {
engine: this.get<null | string>("debug.engine"),
engine: this.get<string>("debug.engine"),
sourceFileMap: this.get<Record<string, string>>("debug.sourceFileMap"),
};
}