Skip to content

Commit 1373315

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 a026535 commit 1373315

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
@@ -118,7 +118,7 @@ package body LSP.Ada_Handlers is
118118

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

@@ -984,20 +984,18 @@ package body LSP.Ada_Handlers is
984984
Response.result.capabilities.documentFormattingProvider :=
985985
(Is_Set => True,
986986
Value => (workDoneProgress => LSP.Types.None));
987+
if Partial_GNATpp.Is_Active then
988+
Response.result.capabilities.documentRangeFormattingProvider :=
989+
(Is_Set => True,
990+
Value => (workDoneProgress => LSP.Types.None));
991+
end if;
987992
Response.result.capabilities.callHierarchyProvider :=
988993
(Is_Set => True,
989994
Value => (Is_Boolean => False, Options => <>));
990995
Response.result.capabilities.documentHighlightProvider :=
991996
(Is_Set => True,
992997
Value => (workDoneProgress => LSP.Types.None));
993998

994-
-- lalpp does not support range formatting for now
995-
-- do not set the option
996-
--
997-
-- Response.result.capabilities.documentRangeFormattingProvider :=
998-
-- (Is_Set => True,
999-
-- Value => (workDoneProgress => LSP.Types.None));
1000-
1001999
Response.result.capabilities.workspaceSymbolProvider :=
10021000
(Is_Set => True,
10031001
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)