diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-02 21:47:44 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-02 21:47:44 +0000 |
commit | a4c30d750411f09a999b201631000a08e88907fd (patch) | |
tree | 1034c83bd53ab42e916f58c73249678a04a0085f /editors/code | |
parent | 54efd8204ec05313007d42351fe4701061b06a67 (diff) | |
parent | 96f0683974406055e98ff88af3b01327aae8ba61 (diff) |
Merge #408
408: vscode problem matcher improvements r=matklad a=vemoo
The problem matcher wasn't working properly and looking at the rustc errors i realized it could be simplified.
I also added a new problem matcher that can be used with https://github.com/passcod/cargo-watch to get the errors in the editor on save. To use it one can create a tasks.json file with:
```json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "cargo watch",
"command": "cargo",
"isBackground": true,
"args": [
"watch",
"-c"
],
"problemMatcher": [
"$rustc-watch"
]
}
]
}
```
I initially implemented it like this: https://github.com/rust-analyzer/rust-analyzer/commit/cff9f62d321a90c45e622f5304e60a248cbcf4f2 but i think there's a bug in vscode so i worked around it by copying the pattern for both problem matchers. The first commit can be used if https://github.com/Microsoft/vscode/pull/65840 is merged.
Co-authored-by: Bernardo <[email protected]>
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/package.json | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index 2989a7016..e0db3c337 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -145,6 +145,26 @@ | |||
145 | } | 145 | } |
146 | } | 146 | } |
147 | }, | 147 | }, |
148 | "problemPatterns": [ | ||
149 | { | ||
150 | "//comment": "named multiline problem patterns are not parsed properly in vscode at the moment, when fixed in vscode replace both \"pattern\": [...] below with \"pattern\": \"$rustc\"", | ||
151 | "name": "rustc", | ||
152 | "patterns": [ | ||
153 | { | ||
154 | "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", | ||
155 | "severity": 1, | ||
156 | "code": 2, | ||
157 | "message": 3 | ||
158 | }, | ||
159 | { | ||
160 | "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", | ||
161 | "file": 1, | ||
162 | "line": 2, | ||
163 | "column": 3 | ||
164 | } | ||
165 | ] | ||
166 | } | ||
167 | ], | ||
148 | "problemMatchers": [ | 168 | "problemMatchers": [ |
149 | { | 169 | { |
150 | "name": "rustc", | 170 | "name": "rustc", |
@@ -154,28 +174,44 @@ | |||
154 | ], | 174 | ], |
155 | "pattern": [ | 175 | "pattern": [ |
156 | { | 176 | { |
157 | "regexp": "^(warning|warn|error)(\\[(.*)\\])?: (.*)$", | 177 | "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", |
158 | "severity": 1, | 178 | "severity": 1, |
159 | "message": 4, | 179 | "code": 2, |
160 | "code": 3 | 180 | "message": 3 |
161 | }, | 181 | }, |
162 | { | 182 | { |
163 | "regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$", | 183 | "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", |
164 | "file": 2, | 184 | "file": 1, |
165 | "line": 3, | 185 | "line": 2, |
166 | "column": 4 | 186 | "column": 3 |
167 | }, | 187 | } |
188 | ] | ||
189 | }, | ||
190 | { | ||
191 | "name": "rustc-watch", | ||
192 | "fileLocation": [ | ||
193 | "relative", | ||
194 | "${workspaceRoot}" | ||
195 | ], | ||
196 | "background": { | ||
197 | "beginsPattern": "^\\[Running ", | ||
198 | "endsPattern": "^(\\[Finished running\\]|To learn more, run the command again with --verbose\\.)$" | ||
199 | }, | ||
200 | "pattern": [ | ||
168 | { | 201 | { |
169 | "regexp": "^.*$" | 202 | "regexp": "^(warning|warn|error)(?:\\[(.*?)\\])?: (.*)$", |
203 | "severity": 1, | ||
204 | "code": 2, | ||
205 | "message": 3 | ||
170 | }, | 206 | }, |
171 | { | 207 | { |
172 | "regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$", | 208 | "regexp": "^[\\s->=]*(.*?):(\\d*):(\\d*)\\s*$", |
173 | "file": 2, | 209 | "file": 1, |
174 | "line": 3, | 210 | "line": 2, |
175 | "column": 4 | 211 | "column": 3 |
176 | } | 212 | } |
177 | ] | 213 | ] |
178 | } | 214 | } |
179 | ] | 215 | ] |
180 | } | 216 | } |
181 | } | 217 | } \ No newline at end of file |