From 6d25ba096fef603807e59fbf71c3b0ac74715869 Mon Sep 17 00:00:00 2001 From: Dushyant Acharya Date: Mon, 18 May 2026 03:22:57 +0530 Subject: [PATCH 1/2] docs: clarify terminal line wrapping for multiline problem matchers --- docs/debugtest/tasks.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/debugtest/tasks.md b/docs/debugtest/tasks.md index 84e7edb3a9..4a99fac2e3 100644 --- a/docs/debugtest/tasks.md +++ b/docs/debugtest/tasks.md @@ -727,8 +727,11 @@ test.js Our problem matcher is line-based so we need to capture the file name (test.js) with a different regular expression than the actual problem location and message (1:0 error Missing "use strict" statement). To do this, use an array of problem patterns for the `pattern` property. This way you define a pattern per each line you want to match. + > **Note:** In a multi-line problem matcher, each line in the output must be matched sequentially by the pattern array. Intermediate lines cannot be skipped, even if they are not needed for capturing values. +> **Note:** Terminal line wrapping can break multi-line problem matchers. If a line of output is too long and the terminal wraps it into two lines, VS Code processes it as two separate lines. Your problem matcher will fail unless your pattern array accounts for the extra wrapped line. To avoid this, ensure your terminal is wide enough or configure your build tool to disable line wrapping if possible. + The following problem pattern matches the output from ESLint in stylish mode - but still has one small issue that we need to resolve next. The code below has a first regular expression to capture the file name and the second to capture the line, column, severity, message, and error code: ```json From e73da9294e8d12d18f37f38b8d6bcb766b3e34c5 Mon Sep 17 00:00:00 2001 From: Nick Trogh Date: Wed, 27 May 2026 22:56:07 +0200 Subject: [PATCH 2/2] Update note and add clarifying example --- docs/debugtest/tasks.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/debugtest/tasks.md b/docs/debugtest/tasks.md index 4a99fac2e3..63332f98ce 100644 --- a/docs/debugtest/tasks.md +++ b/docs/debugtest/tasks.md @@ -379,7 +379,7 @@ You can specify a task's run behaviors using the `runOptions` property: * `terminateNewest` - Terminate the newest running instance. * `terminateOldest` - Terminate the oldest running instance. * `warn` - Don't start a new instance (show warning). - + ## Customizing auto-detected tasks As mentioned above, you can customize auto-detected tasks in the `tasks.json` file. You usually do so to modify presentation properties or to attach a problem matcher to scan the task's output for errors and warnings. You can customize a task directly from the **Run Task** list by pressing the gear icon to the right to insert the corresponding task reference into the `tasks.json` file. Assume you have the following Gulp file to lint JavaScript files using ESLint (the file is taken from [https://github.com/adametry/gulp-eslint](https://github.com/adametry/gulp-eslint)): @@ -728,9 +728,17 @@ Our problem matcher is line-based so we need to capture the file name (test.js) To do this, use an array of problem patterns for the `pattern` property. This way you define a pattern per each line you want to match. -> **Note:** In a multi-line problem matcher, each line in the output must be matched sequentially by the pattern array. Intermediate lines cannot be skipped, even if they are not needed for capturing values. +> **Note:** In a multi-line problem matcher, the pattern array must match every consecutive line of output, starting from the first pattern. You cannot skip intermediate lines, even if they contain no useful information. + +If your tool outputs three lines and you only need data from the first and third, your pattern array still needs three entries. Use `{"regexp": "^.*$"}` with no capture group assignments for lines you don't need data from: -> **Note:** Terminal line wrapping can break multi-line problem matchers. If a line of output is too long and the terminal wraps it into two lines, VS Code processes it as two separate lines. Your problem matcher will fail unless your pattern array accounts for the extra wrapped line. To avoid this, ensure your terminal is wide enough or configure your build tool to disable line wrapping if possible. +```json +"pattern": [ + { "regexp": "^Error:\\s+(.*)$", "message": 1 }, + { "regexp": "^.*$" }, + { "regexp": "^\\s+at\\s+(.*):(\\d+)$", "file": 1, "line": 2 } +] +``` The following problem pattern matches the output from ESLint in stylish mode - but still has one small issue that we need to resolve next. The code below has a first regular expression to capture the file name and the second to capture the line, column, severity, message, and error code: