Auto merge of #15186 - matklad:panic, r=HKalbasi

feat: don't add panics to error jump list by default

To re-enable this, use

    "rust-analyzer.runnables.problemMatcher": [
        "$rustc",
        "$rust-panic"
    ],

setting.

closes: #14977
This commit is contained in:
bors 2023-07-03 02:40:35 +00:00
commit e175595985
4 changed files with 19 additions and 1 deletions

View file

@ -339,6 +339,16 @@
"default": null, "default": null,
"markdownDescription": "Environment variables passed to the runnable launched using `Test` or `Debug` lens or `rust-analyzer.run` command." "markdownDescription": "Environment variables passed to the runnable launched using `Test` or `Debug` lens or `rust-analyzer.run` command."
}, },
"rust-analyzer.runnables.problemMatcher": {
"type": "array",
"items": {
"type": "string"
},
"default": [
"$rustc"
],
"markdownDescription": "Problem matchers to use for `rust-analyzer.run` command, eg `[\"$rustc\", \"$rust-panic\"]`."
},
"rust-analyzer.server.path": { "rust-analyzer.server.path": {
"type": [ "type": [
"null", "null",

View file

@ -220,6 +220,10 @@ export class Config {
return this.get<string[] | undefined>("discoverProjectCommand"); return this.get<string[] | undefined>("discoverProjectCommand");
} }
get problemMatcher(): string[] {
return this.get<string[]>("runnables.problemMatcher") || [];
}
get cargoRunner() { get cargoRunner() {
return this.get<string | undefined>("cargoRunner"); return this.get<string | undefined>("cargoRunner");
} }

View file

@ -151,6 +151,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
definition, definition,
runnable.label, runnable.label,
args, args,
config.problemMatcher,
config.cargoRunner, config.cargoRunner,
true true
); );

View file

@ -46,6 +46,7 @@ class CargoTaskProvider implements vscode.TaskProvider {
{ type: TASK_TYPE, command: def.command }, { type: TASK_TYPE, command: def.command },
`cargo ${def.command}`, `cargo ${def.command}`,
[def.command], [def.command],
this.config.problemMatcher,
this.config.cargoRunner this.config.cargoRunner
); );
vscodeTask.group = def.group; vscodeTask.group = def.group;
@ -70,6 +71,7 @@ class CargoTaskProvider implements vscode.TaskProvider {
definition, definition,
task.name, task.name,
args, args,
this.config.problemMatcher,
this.config.cargoRunner this.config.cargoRunner
); );
} }
@ -83,6 +85,7 @@ export async function buildCargoTask(
definition: CargoTaskDefinition, definition: CargoTaskDefinition,
name: string, name: string,
args: string[], args: string[],
problemMatcher: string[],
customRunner?: string, customRunner?: string,
throwOnError: boolean = false throwOnError: boolean = false
): Promise<vscode.Task> { ): Promise<vscode.Task> {
@ -128,7 +131,7 @@ export async function buildCargoTask(
name, name,
TASK_SOURCE, TASK_SOURCE,
exec, exec,
["$rustc", "$rust-panic"] problemMatcher
); );
} }