Skip to content

Commit 20c7867

Browse files
Merge branch 'topic/als.784.patternMatchers' into 'master'
Create proper patternMatchers for ada Closes #784 See merge request eng/ide/ada_language_server!1964
2 parents 9f0a08c + fd7eca5 commit 20c7867

File tree

17 files changed

+203
-41
lines changed

17 files changed

+203
-41
lines changed

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"label": "Run tests",
66
"type": "shell",
77
"command": "make check",
8-
"problemMatcher": ["$ada"],
8+
"problemMatcher": ["$ada-error", "$ada-warning", "$ada-info"],
99
"group": "test"
1010
},
1111
{
@@ -30,7 +30,7 @@
3030
"type": "ada",
3131
"command": "make",
3232
"args": ["GPRBUILD_CARGS=-cargs:ada -gnatef"],
33-
"problemMatcher": ["$ada"],
33+
"problemMatcher": ["$ada-error", "$ada-warning", "$ada-info"],
3434
"group": "build",
3535
"label": "ada: Build current project",
3636
"presentation": {

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ by providing extra tool command line options via the `args` property of the obje
197197
"-gargs",
198198
"-vh"
199199
],
200-
"problemMatcher": ["$ada"],
200+
"problemMatcher": ["$ada-error", "$ada-warning", "$ada-info"],
201201
"group": "build",
202202
"label": "ada: Build current project"
203203
}
@@ -225,7 +225,7 @@ You can also customize the working directory of the task or the environment vari
225225
"MY_ENV_VAR": "value"
226226
}
227227
},
228-
"problemMatcher": ["$ada"],
228+
"problemMatcher": ["$ada-error", "$ada-warning", "$ada-info"],
229229
"group": "build",
230230
"label": "ada: Build current project"
231231
}

doc/Getting-Started.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ Your new `tasks.json` file should look similar to the JSON below:
189189
"-gnatef"
190190
],
191191
"problemMatcher": [
192-
"$ada"
192+
"$ada-error",
193+
"$ada-warning",
194+
"$ada-info"
193195
],
194196
"group": {
195197
"kind": "build",

integration/vscode/Code Samples/docker/.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
"-cargs",
1515
"-gnatef"
1616
],
17-
"problemMatcher": ["$ada"],
17+
"problemMatcher": ["$ada-error", "$ada-warning", "$ada-info"],
1818
"group": {
1919
"kind": "build",
2020
"isDefault": true
2121
}
2222
}
2323
]
24-
}
24+
}

integration/vscode/Code Samples/gnatprove/.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"-cargs",
1818
"-gnatef"
1919
],
20-
"problemMatcher": ["$ada"],
20+
"problemMatcher": ["$ada-error", "$ada-warning", "$ada-info"],
2121
"group": {
2222
"kind": "build",
2323
"isDefault": true

integration/vscode/Code Samples/hello/.vscode/tasks.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
]
1515
},
1616
"problemMatcher": [
17-
"$ada"
17+
"$ada-error",
18+
"$ada-warning",
19+
"$ada-info"
1820
],
1921
"group": "build",
2022
"label": "ada: Build project",

integration/vscode/ada/package.json

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,24 +512,81 @@
512512
}
513513
],
514514
"problemMatchers": [
515-
{
515+
{
516516
"name": "ada",
517-
"label": "Gnat Ada Problem Matcher",
517+
"label": "Gnat Ada Problem Matcher (obsolete)",
518+
"fileLocation": [
519+
"autoDetect",
520+
"${workspaceRoot}"
521+
],
522+
"pattern": [
523+
{
524+
"regexp": "^([^:]:?[^:]*):(\\d+):(\\d+):\\s+(?:([a-z]+):\\s+)?(.*)$",
525+
"file": 1,
526+
"line": 2,
527+
"column": 3,
528+
"severity": 4,
529+
"message": 5
530+
}
531+
]
532+
},
533+
{
534+
"name": "ada-error",
535+
"label": "Gnat Ada Error Problem Matcher",
518536
"fileLocation": [
519537
"autoDetect",
520538
"${workspaceRoot}"
521539
],
540+
"source": "ada",
541+
"severity": "error",
522542
"pattern": [
523543
{
524-
"regexp": "^([^:]:?[^:]*):(\\d+):(\\d+):\\s+(?:([a-z]+):\\s+)?(.*)$",
544+
"regexp": "^([^:]:?[^:]*):(\\d+):(\\d+):\\s+[\\(:]?(error)[\\):]?\\s+(.*)$",
525545
"file": 1,
526546
"line": 2,
527547
"column": 3,
528-
"severity": 4,
529548
"message": 5
530549
}
531550
]
532-
}
551+
},
552+
{
553+
"name": "ada-warning",
554+
"label": "Gnat Ada Warning Problem Matcher",
555+
"fileLocation": [
556+
"autoDetect",
557+
"${workspaceRoot}"
558+
],
559+
"source": "ada",
560+
"severity": "warning",
561+
"pattern": [
562+
{
563+
"regexp": "^([^:]:?[^:]*):(\\d+):(\\d+):\\s+[\\(:]?(warning|medium|medium warning|low|low warning|style)[\\):]?\\s+(.*)$",
564+
"file": 1,
565+
"line": 2,
566+
"column": 3,
567+
"message": 5
568+
}
569+
]
570+
},
571+
{
572+
"name": "ada-info",
573+
"label": "Gnat Ada Info Problem Matcher",
574+
"fileLocation": [
575+
"autoDetect",
576+
"${workspaceRoot}"
577+
],
578+
"source": "ada",
579+
"severity": "info",
580+
"pattern": [
581+
{
582+
"regexp": "^([^:]:?[^:]*):(\\d+):(\\d+):\\s+[\\(:]?(info|[Nn]ote|check)[\\):]?\\s+(.*)$",
583+
"file": 1,
584+
"line": 2,
585+
"column": 3,
586+
"message": 5
587+
}
588+
]
589+
}
533590
],
534591
"taskDefinitions": [
535592
{

integration/vscode/ada/src/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { AdaConfig, getOrAskForProgram, initializeConfig } from './debugConfigPr
1010
import { adaExtState, logger, mainOutputChannel } from './extension';
1111
import { findAdaMain, getProjectFileRelPath, getSymbols } from './helpers';
1212
import {
13-
DEFAULT_PROBLEM_MATCHER,
13+
DEFAULT_PROBLEM_MATCHERS,
1414
SimpleTaskDef,
1515
TASK_PROVE_FILE_PLAIN_NAME,
1616
TASK_PROVE_LINE_PLAIN_NAME,
@@ -1026,7 +1026,7 @@ async function sparkProveSubprogram(
10261026
* empty problem matcher list which would hide problems from the
10271027
* Problems view.
10281028
*/
1029-
task.problemMatchers.length > 0 ? task.problemMatchers : [DEFAULT_PROBLEM_MATCHER],
1029+
task.problemMatchers.length > 0 ? task.problemMatchers : DEFAULT_PROBLEM_MATCHERS,
10301030
);
10311031

10321032
/**

integration/vscode/ada/src/gnatTaskProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import commandExists from 'command-exists';
1919
import * as vscode from 'vscode';
2020
import { getProjectFromConfigOrALS, sparkLimitRegionArg, sparkLimitSubpArg } from './commands';
21-
import { DEFAULT_PROBLEM_MATCHER, WarningMessageExecution } from './taskProviders';
21+
import { DEFAULT_PROBLEM_MATCHERS, WarningMessageExecution } from './taskProviders';
2222

2323
/**
2424
* Callback to provide an extra argument for a tool
@@ -238,7 +238,7 @@ export class GnatTaskProvider implements vscode.TaskProvider<vscode.Task> {
238238
msg,
239239
GnatTaskProvider.gnatType,
240240
this.obsoleteWarningExecution,
241-
DEFAULT_PROBLEM_MATCHER,
241+
DEFAULT_PROBLEM_MATCHERS,
242242
),
243243
];
244244
} else {
@@ -269,7 +269,7 @@ export class GnatTaskProvider implements vscode.TaskProvider<vscode.Task> {
269269
task.name,
270270
GnatTaskProvider.gnatType,
271271
this.obsoleteWarningExecution,
272-
DEFAULT_PROBLEM_MATCHER,
272+
DEFAULT_PROBLEM_MATCHERS,
273273
);
274274
}
275275
}

integration/vscode/ada/src/gnattest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { addCoverageData, GnatcovFileCoverage } from './gnatcov';
1111
import { getScenarioArgs } from './gnatTaskProvider';
1212
import { escapeRegExp, exe, setTerminalEnvironment, slugify } from './helpers';
1313
import {
14-
DEFAULT_PROBLEM_MATCHER,
14+
DEFAULT_PROBLEM_MATCHERS,
1515
findTaskByName,
1616
runTaskSequence,
1717
SimpleTaskDef,
@@ -750,7 +750,7 @@ async function handleRunRequestedTests(
750750
`Create GNATcoverage XML report`,
751751
TASK_TYPE_ADA,
752752
undefined,
753-
DEFAULT_PROBLEM_MATCHER,
753+
DEFAULT_PROBLEM_MATCHERS,
754754
),
755755
))!;
756756
gnatcovReportTask.presentationOptions.reveal = vscode.TaskRevealKind.Never;
@@ -841,7 +841,7 @@ async function buildTestDriverAndReportErrors(
841841
instTaskName,
842842
TASK_TYPE_ADA,
843843
undefined,
844-
DEFAULT_PROBLEM_MATCHER,
844+
DEFAULT_PROBLEM_MATCHERS,
845845
),
846846
))!;
847847
instTask.presentationOptions.reveal =
@@ -878,7 +878,7 @@ async function buildTestDriverAndReportErrors(
878878
buildTaskName,
879879
TASK_TYPE_ADA,
880880
undefined,
881-
DEFAULT_PROBLEM_MATCHER,
881+
DEFAULT_PROBLEM_MATCHERS,
882882
),
883883
))!;
884884
buildTask.presentationOptions.reveal = vscode.TaskRevealKind.Never;

0 commit comments

Comments
 (0)