Skip to content

Commit dcc4993

Browse files
UB30-006 Use partial gnatpp by default
Set ALS.PARTIAL_GNATPP Trace to On by default which sets documentRangeFormattingProvider to True by default. Update range formatting test bsseline.
1 parent 70e06b4 commit dcc4993

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

source/ada/lsp-ada_handlers.adb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ package body LSP.Ada_Handlers is
119119

120120
Partial_GNATpp : constant GNATCOLL.Traces.Trace_Handle :=
121121
GNATCOLL.Traces.Create ("ALS.PARTIAL_GNATPP",
122-
GNATCOLL.Traces.Off);
122+
GNATCOLL.Traces.On);
123123
-- Use partial formatting mode of gnatpp if On. Otherwise, use diff
124124
-- algorithm.
125125

@@ -953,20 +953,18 @@ package body LSP.Ada_Handlers is
953953
Response.result.capabilities.documentFormattingProvider :=
954954
(Is_Set => True,
955955
Value => (workDoneProgress => LSP.Types.None));
956+
if Partial_GNATpp.Is_Active then
957+
Response.result.capabilities.documentRangeFormattingProvider :=
958+
(Is_Set => True,
959+
Value => (workDoneProgress => LSP.Types.None));
960+
end if;
956961
Response.result.capabilities.callHierarchyProvider :=
957962
(Is_Set => True,
958963
Value => (Is_Boolean => False, Options => <>));
959964
Response.result.capabilities.documentHighlightProvider :=
960965
(Is_Set => True,
961966
Value => (workDoneProgress => LSP.Types.None));
962967

963-
-- lalpp does not support range formatting for now
964-
-- do not set the option
965-
--
966-
-- Response.result.capabilities.documentRangeFormattingProvider :=
967-
-- (Is_Set => True,
968-
-- Value => (workDoneProgress => LSP.Types.None));
969-
970968
Response.result.capabilities.workspaceSymbolProvider :=
971969
(Is_Set => True,
972970
Value => (workDoneProgress => LSP.Types.None));

testsuite/ada_lsp/T527-019.range_formatting/test.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@
134134
{
135135
"range": {
136136
"start": {
137-
"line": 2,
137+
"line": 0,
138138
"character": 0
139139
},
140140
"end": {
141-
"line": 7,
142-
"character": 0
141+
"line": 8,
142+
"character": 9
143143
}
144144
},
145-
"newText": " X : Integer := (1 + 2 + 3);\nbegin\n -- Insert code here.\n"
145+
"newText": "procedure Main is\n -- comment\n X : Integer := (1 + 2 + 3);\nbegin\n -- Insert code here.\n null;\nend Main;"
146146
}
147147
]
148148
}
@@ -269,15 +269,15 @@
269269
{
270270
"range": {
271271
"start": {
272-
"line": 4,
272+
"line": 0,
273273
"character": 0
274274
},
275275
"end": {
276-
"line": 5,
277-
"character": 0
276+
"line": 6,
277+
"character": 9
278278
}
279279
},
280-
"newText": " -- Insert code here.\n"
280+
"newText": "procedure Main is\n -- comment\n X : Integer := (1 + 2 + 3);\nbegin\n -- Insert code here.\n null;\nend Main;"
281281
}
282282
]
283283
}

0 commit comments

Comments
 (0)