Skip to content

Commit cf0aeae

Browse files
Merge branch 'topic/als.1455.diag_setting_refresh' into 'master'
Improve settings related to diagnostics See merge request eng/ide/ada_language_server!1947
2 parents 4e4473b + efd541f commit cf0aeae

25 files changed

+1496
-106
lines changed

doc/settings.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Settings understood by the Ada Language Server itself, independently from the LS
108108
* [rootDir](#rootdir)
109109
* [enableDiagnostics](#enableddiagnostics)
110110
* [adaFileDiagnostics](#adafilediagnostics)
111+
* [gprFileDiagnostics](#gprfilediagnostics)
111112
* [projectDiagnostics](#projectdiagnostics)
112113
* [alireDiagnostics](#alirediagnostics)
113114
* [enableIndexing](#enableindexing)
@@ -236,6 +237,17 @@ The value is a boolean.
236237
'adaFileDiagnostics': false
237238
```
238239

240+
### gprFileDiagnostics
241+
242+
You can explicitly deactivate the emission of diagnostics related to the
243+
edition of gpr Files via the `gprFileDiagnostics` key. By default,
244+
diagnostics are enabled.
245+
The value is a boolean.
246+
247+
```javascript
248+
'gprFileDiagnostics': false
249+
```
250+
239251
### projectDiagnostics
240252

241253
You can explicitly deactivate the emission of diagnostics when loading a

integration/vscode/ada/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@
426426
"scope": "window",
427427
"type": "boolean",
428428
"default": null,
429-
"description": "Controls whether or not the Ada Language Server should emit project diagnostics into the VS Code Problems view."
429+
"description": "Controls whether or not the Ada Language Server should emit diagnostics related to project loading into the VS Code Problems view."
430430
},
431431
"ada.alireDiagnostics": {
432432
"scope": "window",
@@ -438,7 +438,13 @@
438438
"scope": "window",
439439
"type": "boolean",
440440
"default": null,
441-
"description": "Controls whether or not the Ada Language Server should emit diagnostics related to Ada files into the VS Code Problems view."
441+
"description": "Controls whether or not the Ada Language Server should emit diagnostics related to the edition of Ada files into the VS Code Problems view."
442+
},
443+
"ada.gprFileDiagnostics": {
444+
"scope": "window",
445+
"type": "boolean",
446+
"default": null,
447+
"description": "Controls whether or not the Ada Language Server should emit diagnostics related to the edition of GPR files into the VS Code Problems view."
442448
}
443449
}
444450
},

integration/vscode/ada/schemas/als-settings-schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@
8888
"adaFileDiagnostics": {
8989
"type": "boolean",
9090
"default": true,
91-
"description": "Controls whether or not the Ada Language Server should emit diagnostics related to Ada Files into the VS Code Problems view."
91+
"description": "Controls whether or not the Ada Language Server should emit diagnostics related to the edition of Ada Files into the VS Code Problems view."
92+
},
93+
"gprFileDiagnostics": {
94+
"type": "boolean",
95+
"default": true,
96+
"description": "Controls whether or not the Ada Language Server should emit diagnostics related to the edition of GPR Files into the VS Code Problems view."
9297
},
9398
"foldComments": {
9499
"type": "boolean",

liblsp_3_16/source/lsp-client_notification_receivers.ads

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
with LSP.Types;
2121
with LSP.Messages;
22+
with VSS.Strings;
2223

2324
package LSP.Client_Notification_Receivers is
2425

@@ -28,18 +29,21 @@ package LSP.Client_Notification_Receivers is
2829
-- Receiver of notification on LSP client side
2930

3031
procedure On_Show_Message
31-
(Self : access Client_Notification_Receiver;
32-
Params : LSP.Messages.ShowMessageParams) is abstract;
32+
(Self : access Client_Notification_Receiver;
33+
Params : LSP.Messages.ShowMessageParams;
34+
Language : VSS.Strings.Virtual_String) is abstract;
3335
-- Process window/showMessage notification
3436

3537
procedure On_Log_Message
3638
(Self : access Client_Notification_Receiver;
37-
Params : LSP.Messages.LogMessageParams) is abstract;
39+
Params : LSP.Messages.LogMessageParams;
40+
Language : VSS.Strings.Virtual_String) is abstract;
3841
-- Process window/logMessage notification
3942

4043
procedure On_Publish_Diagnostics
41-
(Self : access Client_Notification_Receiver;
42-
Params : LSP.Messages.PublishDiagnosticsParams) is abstract;
44+
(Self : access Client_Notification_Receiver;
45+
Params : LSP.Messages.PublishDiagnosticsParams;
46+
Language : VSS.Strings.Virtual_String) is abstract;
4347
-- Process textDocument/publishDiagnostics notification
4448

4549
function Get_Progress_Type

liblsp_3_16/source/lsp-messages-client_notifications.adb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,38 @@ package body LSP.Messages.Client_Notifications is
2222
-----------
2323

2424
overriding procedure Visit
25-
(Self : LogMessage_Notification;
26-
Reciver : access Client_Notification_Receiver'Class)
25+
(Self : LogMessage_Notification;
26+
Receiver : access Client_Notification_Receiver'Class)
2727
is
2828
begin
29-
Reciver.On_Log_Message (Self.params);
29+
Receiver.On_Log_Message
30+
(Self.params, VSS.Strings.Empty_Virtual_String);
3031
end Visit;
3132

3233
-----------
3334
-- Visit --
3435
-----------
3536

3637
overriding procedure Visit
37-
(Self : ShowMessage_Notification;
38-
Reciver : access Client_Notification_Receiver'Class)
38+
(Self : ShowMessage_Notification;
39+
Receiver : access Client_Notification_Receiver'Class)
3940
is
4041
begin
41-
Reciver.On_Show_Message (Self.params);
42+
Receiver.On_Show_Message
43+
(Self.params, VSS.Strings.Empty_Virtual_String);
4244
end Visit;
4345

4446
-----------
4547
-- Visit --
4648
-----------
4749

4850
overriding procedure Visit
49-
(Self : PublishDiagnostics_Notification;
50-
Reciver : access Client_Notification_Receiver'Class)
51+
(Self : PublishDiagnostics_Notification;
52+
Receiver : access Client_Notification_Receiver'Class)
5153
is
5254
begin
53-
Reciver.On_Publish_Diagnostics (Self.params);
55+
Receiver.On_Publish_Diagnostics
56+
(Self.params, VSS.Strings.Empty_Virtual_String);
5457
end Visit;
5558

5659
-----------

liblsp_3_16/source/lsp-messages-client_notifications.ads

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ package LSP.Messages.Client_Notifications is
2727

2828
procedure Visit
2929
(Self : Client_Notification;
30-
Reciver : access Client_Notification_Receiver'Class) is abstract;
30+
Receiver : access Client_Notification_Receiver'Class) is abstract;
3131

3232
package LogMessages is new LSP.Generic_Notifications
3333
(Client_Notification,
@@ -39,7 +39,7 @@ package LSP.Messages.Client_Notifications is
3939

4040
overriding procedure Visit
4141
(Self : LogMessage_Notification;
42-
Reciver : access Client_Notification_Receiver'Class);
42+
Receiver : access Client_Notification_Receiver'Class);
4343

4444
package ShowMessages is new LSP.Generic_Notifications
4545
(Client_Notification,
@@ -51,7 +51,7 @@ package LSP.Messages.Client_Notifications is
5151

5252
overriding procedure Visit
5353
(Self : ShowMessage_Notification;
54-
Reciver : access Client_Notification_Receiver'Class);
54+
Receiver : access Client_Notification_Receiver'Class);
5555

5656
package PublishDiagnostics is new LSP.Generic_Notifications
5757
(Client_Notification,
@@ -63,7 +63,7 @@ package LSP.Messages.Client_Notifications is
6363

6464
overriding procedure Visit
6565
(Self : PublishDiagnostics_Notification;
66-
Reciver : access Client_Notification_Receiver'Class);
66+
Receiver : access Client_Notification_Receiver'Class);
6767

6868
package Progress_Params is new LSP.Generic_Notifications
6969
(Client_Notification,

source/ada/lsp-ada_configurations.adb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ package body LSP.Ada_Configurations is
345345
then
346346
Self.Ada_File_Diagnostics_Enabled := JSON (Index).Boolean_Value;
347347

348+
elsif Check_Variable
349+
(Name, JSON (Index).Kind, "gprFileDiagnostics", Boolean_Value)
350+
then
351+
Self.GPR_File_Diagnostics_Enabled := JSON (Index).Boolean_Value;
352+
348353
elsif Check_Variable
349354
(Name, JSON (Index).Kind, "enableIndexing", Boolean_Value)
350355
then

source/ada/lsp-ada_configurations.ads

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,17 @@ package LSP.Ada_Configurations is
9090

9191
function Ada_File_Diagnostics_Enabled
9292
(Self : Configuration'Class) return Boolean;
93-
-- Whether to publish file related diagnostics
93+
-- Whether to publish ada file related diagnostics
94+
95+
function GPR_File_Diagnostics_Enabled
96+
(Self : Configuration'Class) return Boolean;
97+
-- Whether to publish diagnostics related to GPR files' edition. This
98+
-- is used by GLS only and is different from Project_Diagnostics_Enabled.
9499

95100
function Project_Diagnostics_Enabled
96101
(Self : Configuration'Class) return Boolean;
97-
-- Whether to publish project related diagnostics
102+
-- Whether to publish project related diagnostics. This is used by the
103+
-- ALS only.
98104

99105
function Alire_Diagnostics_Enabled
100106
(Self : Configuration'Class) return Boolean;
@@ -167,6 +173,7 @@ private
167173
Named_Notation_Threshold : Natural := 3;
168174
Log_Threshold : Natural := 10;
169175
Ada_File_Diagnostics_Enabled : Boolean := True;
176+
GPR_File_Diagnostics_Enabled : Boolean := True;
170177
Project_Diagnostics_Enabled : Boolean := True;
171178
Alire_Diagnostics_Enabled : Boolean := True;
172179
Indexing_Enabled : Boolean := True;
@@ -216,6 +223,11 @@ private
216223
return Boolean is
217224
(Self.Ada_File_Diagnostics_Enabled);
218225

226+
function GPR_File_Diagnostics_Enabled
227+
(Self : Configuration'Class)
228+
return Boolean is
229+
(Self.GPR_File_Diagnostics_Enabled);
230+
219231
function Project_Diagnostics_Enabled
220232
(Self : Configuration'Class)
221233
return Boolean is (Self.Project_Diagnostics_Enabled);

source/ada/lsp-ada_did_change_configurations.adb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ package body LSP.Ada_Did_Change_Configurations is
6464
Self.Parent.Context.Reload_Project;
6565
end if;
6666

67+
Self.Parent.Context.Refresh_Diagnostics;
6768
exception
6869
when E : others =>
6970
Self.Parent.Context.Trace_Exception (E);

0 commit comments

Comments
 (0)