Skip to content

Commit 5bfa17e

Browse files
Adapt tests to new project diagnostics
For eng/ide/ada_language_server#1211
1 parent 20e3595 commit 5bfa17e

File tree

5 files changed

+166
-290
lines changed

5 files changed

+166
-290
lines changed

source/ada/lsp-ada_handlers-project_diagnostics.adb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ package body LSP.Ada_Handlers.Project_Diagnostics is
130130

131131
procedure Append_GPR2_Diagnostics is
132132
use GPR2.Message;
133+
use LSP.Enumerations;
133134
begin
134135
for Msg of GPR2_Messages loop
135136
if Msg.Level in GPR2.Message.Warning .. GPR2.Message.Error then
@@ -156,11 +157,15 @@ package body LSP.Ada_Handlers.Project_Diagnostics is
156157
-- If we have one error in the GPR2 messages, the parent
157158
-- diagnostic's severity should be "error" too, otherwise
158159
-- "warning".
159-
Parent_Diagnostic.severity :=
160-
(if Msg.Level = GPR2.Message.Error then
161-
(True, LSP.Enumerations.Error)
162-
else
163-
(True, LSP.Enumerations.Warning));
160+
if Msg.Level = GPR2.Message.Error then
161+
Parent_Diagnostic.severity :=
162+
(True, LSP.Enumerations.Error);
163+
elsif Parent_Diagnostic.severity.Value /=
164+
LSP.Enumerations.Error
165+
then
166+
Parent_Diagnostic.severity :=
167+
(True, LSP.Enumerations.Warning);
168+
end if;
164169
end if;
165170
end loop;
166171
end Append_GPR2_Diagnostics;

testsuite/ada_lsp/T123-048.incremental_editing/test.json

Lines changed: 32 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
},
77
{
88
"start": {
9-
"cmd": [
10-
"${ALS}"
11-
]
9+
"cmd": ["${ALS}"]
1210
}
1311
},
1412
{
@@ -27,42 +25,16 @@
2725
"textDocument": {
2826
"completion": {
2927
"completionItem": {
30-
"documentationFormat": [
31-
"markdown",
32-
"plaintext"
33-
],
28+
"documentationFormat": ["markdown", "plaintext"],
3429
"commitCharactersSupport": true,
3530
"preselectSupport": true,
3631
"deprecatedSupport": true,
3732
"snippetSupport": true
3833
},
3934
"completionItemKind": {
4035
"valueSet": [
41-
1,
42-
2,
43-
3,
44-
4,
45-
5,
46-
6,
47-
7,
48-
8,
49-
9,
50-
10,
51-
11,
52-
12,
53-
13,
54-
14,
55-
15,
56-
16,
57-
17,
58-
18,
59-
19,
60-
20,
61-
21,
62-
22,
63-
23,
64-
24,
65-
25
36+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
37+
16, 17, 18, 19, 20, 21, 22, 23, 24, 25
6638
]
6739
},
6840
"contextSupport": true,
@@ -74,21 +46,15 @@
7446
},
7547
"signatureHelp": {
7648
"signatureInformation": {
77-
"documentationFormat": [
78-
"markdown",
79-
"plaintext"
80-
],
49+
"documentationFormat": ["markdown", "plaintext"],
8150
"parameterInformation": {
8251
"labelOffsetSupport": true
8352
}
8453
},
8554
"dynamicRegistration": true
8655
},
8756
"hover": {
88-
"contentFormat": [
89-
"markdown",
90-
"plaintext"
91-
],
57+
"contentFormat": ["markdown", "plaintext"],
9258
"dynamicRegistration": true
9359
},
9460
"declaration": {
@@ -129,32 +95,8 @@
12995
"documentSymbol": {
13096
"symbolKind": {
13197
"valueSet": [
132-
1,
133-
2,
134-
3,
135-
4,
136-
5,
137-
6,
138-
7,
139-
8,
140-
9,
141-
10,
142-
11,
143-
12,
144-
13,
145-
14,
146-
15,
147-
16,
148-
17,
149-
18,
150-
19,
151-
20,
152-
21,
153-
22,
154-
23,
155-
24,
156-
25,
157-
26
98+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
99+
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26
158100
]
159101
},
160102
"hierarchicalDocumentSymbolSupport": true,
@@ -213,43 +155,15 @@
213155
"symbol": {
214156
"symbolKind": {
215157
"valueSet": [
216-
1,
217-
2,
218-
3,
219-
4,
220-
5,
221-
6,
222-
7,
223-
8,
224-
9,
225-
10,
226-
11,
227-
12,
228-
13,
229-
14,
230-
15,
231-
16,
232-
17,
233-
18,
234-
19,
235-
20,
236-
21,
237-
22,
238-
23,
239-
24,
240-
25,
241-
26
158+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
159+
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26
242160
]
243161
},
244162
"dynamicRegistration": true
245163
},
246164
"workspaceEdit": {
247165
"failureHandling": "textOnlyTransactional",
248-
"resourceOperations": [
249-
"create",
250-
"rename",
251-
"delete"
252-
],
166+
"resourceOperations": ["create", "rename", "delete"],
253167
"documentChanges": true
254168
}
255169
}
@@ -282,12 +196,7 @@
282196
"textDocumentSync": 2,
283197
"declarationProvider": true,
284198
"completionProvider": {
285-
"triggerCharacters": [
286-
".",
287-
",",
288-
"'",
289-
"("
290-
],
199+
"triggerCharacters": [".", ",", "'", "("],
291200
"resolveProvider": true
292201
},
293202
"documentSymbolProvider": true
@@ -330,7 +239,9 @@
330239
"wait": []
331240
}
332241
},
333-
{"comment": "--------------------------- open a file -------------------------"},
242+
{
243+
"comment": "--------------------------- open a file -------------------------"
244+
},
334245
{
335246
"send": {
336247
"request": {
@@ -348,7 +259,9 @@
348259
"wait": []
349260
}
350261
},
351-
{"comment": "--------------------------- query a tooltip to verify -------------------------"},
262+
{
263+
"comment": "--------------------------- query a tooltip to verify -------------------------"
264+
},
352265
{
353266
"send": {
354267
"request": {
@@ -385,7 +298,9 @@
385298
]
386299
}
387300
},
388-
{"comment": "--------------------------- insert a space in the middle of a function name -------------------------"},
301+
{
302+
"comment": "--------------------------- insert a space in the middle of a function name -------------------------"
303+
},
389304
{
390305
"send": {
391306
"request": {
@@ -414,48 +329,12 @@
414329
"jsonrpc": "2.0",
415330
"method": "textDocument/didChange"
416331
},
417-
"wait": [
418-
{
419-
"params": {
420-
"uri": "$URI{main.adb}",
421-
"diagnostics": [
422-
{
423-
"range": {
424-
"start": {
425-
"line": 2,
426-
"character": 16
427-
},
428-
"end": {
429-
"line": 2,
430-
"character": 24
431-
}
432-
},
433-
"source": "libadalang",
434-
"message": "Missing ';'"
435-
},
436-
{
437-
"range": {
438-
"start": {
439-
"line": 0,
440-
"character": 0
441-
},
442-
"end": {
443-
"line": 0,
444-
"character": 0
445-
}
446-
},
447-
"severity": 4,
448-
"source": "project",
449-
"message": "Unique project in root directory was found and loaded, but it wasn't explicitly configured."
450-
}
451-
]
452-
},
453-
"method": "textDocument/publishDiagnostics"
454-
}
455-
]
332+
"wait": []
456333
}
457334
},
458-
{"comment": "--------------------------- hover should be empty -------------------------"},
335+
{
336+
"comment": "--------------------------- hover should be empty -------------------------"
337+
},
459338
{
460339
"send": {
461340
"request": {
@@ -480,7 +359,9 @@
480359
]
481360
}
482361
},
483-
{"comment": "--------------------------- undo the change -------------------------"},
362+
{
363+
"comment": "--------------------------- undo the change -------------------------"
364+
},
484365
{
485366
"send": {
486367
"request": {
@@ -509,34 +390,12 @@
509390
"jsonrpc": "2.0",
510391
"method": "textDocument/didChange"
511392
},
512-
"wait": [
513-
{
514-
"params": {
515-
"uri": "$URI{main.adb}",
516-
"diagnostics": [
517-
{
518-
"range": {
519-
"start": {
520-
"line": 0,
521-
"character": 0
522-
},
523-
"end": {
524-
"line": 0,
525-
"character": 0
526-
}
527-
},
528-
"severity": 4,
529-
"source": "project",
530-
"message": "Unique project in root directory was found and loaded, but it wasn't explicitly configured."
531-
}
532-
]
533-
},
534-
"method": "textDocument/publishDiagnostics"
535-
}
536-
]
393+
"wait": []
537394
}
538395
},
539-
{"comment": "--------------------------- verify that the hover is good again -------------------------"},
396+
{
397+
"comment": "--------------------------- verify that the hover is good again -------------------------"
398+
},
540399
{
541400
"send": {
542401
"request": {

0 commit comments

Comments
 (0)