@@ -20,7 +20,7 @@ with Ada.Tags;
2020with GNAT.Strings ;
2121with GNATCOLL.Traces ;
2222with GNATCOLL.VFS ;
23-
23+ with Gnatformat.Configuration ;
2424with Gnatformat.Formatting ;
2525
2626with Langkit_Support.Symbols ;
@@ -50,6 +50,7 @@ with LSP.Ada_Id_Iterators;
5050with LSP.Enumerations ;
5151with LSP.Formatters.File_Names ;
5252with LSP.Formatters.Texts ;
53+ with LSP.GNATFormat_Utils ;
5354with LSP.Predicates ;
5455with LSP.Structures.LSPAny_Vectors ;
5556with LSP.Utils ;
@@ -1242,23 +1243,30 @@ package body LSP.Ada_Documents is
12421243 function Range_Format
12431244 (Self : Document;
12441245 Context : LSP.Ada_Contexts.Context;
1245- Span : LSP.Structures.A_Range)
1246+ Span : LSP.Structures.A_Range;
1247+ Options : LSP.Structures.FormattingOptions)
12461248 return LSP.Structures.TextEdit
12471249 is
12481250 use type LSP.Structures.A_Range;
1251+ use Gnatformat.Configuration;
12491252
1253+ Full_Options : Format_Options_Type := Context.Get_Format_Options;
12501254 begin
12511255 if Span = LSP.Text_Documents.Empty_Range then
12521256 return (LSP.Constants.Empty, VSS.Strings.Empty_Virtual_String);
12531257 end if ;
12541258
1259+ -- Combine the project options with the ones from the request
1260+ Full_Options.Overwrite
1261+ (LSP.GNATFormat_Utils.Get_Format_Option (Options));
1262+
12551263 declare
12561264 Range_Formatted_Document :
12571265 constant Gnatformat.Formatting.Formatted_Edits :=
12581266 Gnatformat.Formatting.Range_Format
12591267 (Self.Unit (Context),
12601268 Self.To_Source_Location_Range (Span),
1261- Context.Get_Format_Options );
1269+ Full_Options );
12621270
12631271 begin
12641272 return
0 commit comments