From 7bc60f512ea56c54de30c7e12919c99f7f15ade4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 6 May 2023 16:49:42 +0100 Subject: [PATCH] feat: define problem matcher for panics in VS Code Now in VS Code "go to next error" (`F8`) will bring you to the source of a panic. --- editors/code/package.json | 22 ++++++++++++++++++++++ editors/code/src/tasks.ts | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/editors/code/package.json b/editors/code/package.json index ca00da9f361..04573174235 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -1512,6 +1512,18 @@ "endColumn": 6 } ] + }, + { + "name": "rust-panic", + "patterns": [ + { + "regexp": "^thread '.*' panicked at '(.*)', (.*):(\\d*):(\\d*)$", + "message": 1, + "file": 2, + "line": 3, + "column": 4 + } + ] } ], "languages": [ @@ -1561,6 +1573,16 @@ ], "pattern": "$rustc-json" }, + { + "name": "rust-panic", + "owner": "rust-panic", + "source": "panic", + "fileLocation": [ + "autoDetect", + "${workspaceRoot}" + ], + "pattern": "$rust-panic" + }, { "name": "rustc-watch", "owner": "rustc", diff --git a/editors/code/src/tasks.ts b/editors/code/src/tasks.ts index e6239deeb21..d6509d9aa6e 100644 --- a/editors/code/src/tasks.ts +++ b/editors/code/src/tasks.ts @@ -128,7 +128,7 @@ export async function buildCargoTask( name, TASK_SOURCE, exec, - ["$rustc"] + ["$rustc", "$rust-panic"] ); }