Skip to content

Commit 697d09b

Browse files
godunkoreznikmm
authored andcommitted
Remove use of Ada.Characters.Wide_Wide_Latin_1 when possible.
1 parent 93183d3 commit 697d09b

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

source/ada/lsp-ada_documents.adb

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18-
with Ada.Characters.Wide_Wide_Latin_1;
1918
with Ada.Tags;
2019
with Ada.Unchecked_Deallocation;
2120

@@ -34,7 +33,7 @@ with Utils.Char_Vectors;
3433
with Libadalang.Iterators;
3534
with Libadalang.Sources;
3635

37-
with VSS.Characters;
36+
with VSS.Characters.Latin;
3837
with VSS.Strings.Character_Iterators;
3938
with VSS.Strings.Conversions;
4039
with VSS.Strings.Cursors;
@@ -2018,16 +2017,20 @@ package body LSP.Ada_Documents is
20182017
function Line_Terminator
20192018
(Self : Document'Class) return VSS.Strings.Virtual_String
20202019
is
2021-
(if Self.Line_Terminator.Is_Empty then
2022-
-- Document has no line terminator yet, return LF as most used
2023-
--
2024-
-- Should it be platform specific? CRLF for Windows, CR for Mac?
2020+
use type VSS.Strings.Virtual_String;
20252021

2026-
VSS.Strings.To_Virtual_String
2027-
((1 => Ada.Characters.Wide_Wide_Latin_1.LF))
2022+
begin
2023+
return
2024+
(if Self.Line_Terminator.Is_Empty then
2025+
-- Document has no line terminator yet, return LF as most used
2026+
--
2027+
-- Should it be platform specific? CRLF for Windows, CR for Mac?
20282028

2029-
else
2030-
Self.Line_Terminator);
2029+
1 * VSS.Characters.Latin.Line_Feed
2030+
2031+
else
2032+
Self.Line_Terminator);
2033+
end Line_Terminator;
20312034

20322035
----------------------
20332036
-- Range_Formatting --
@@ -2246,6 +2249,8 @@ package body LSP.Ada_Documents is
22462249
Item : in out LSP.Structures.CompletionItem;
22472250
Compute_Doc_And_Details : Boolean)
22482251
is
2252+
use type VSS.Strings.Virtual_String;
2253+
22492254
begin
22502255
-- Compute the 'documentation' and 'detail' fields immediately if
22512256
-- requested (i.e: when the client does not support lazy computation
@@ -2271,10 +2276,7 @@ package body LSP.Ada_Documents is
22712276
Item.detail := Decl_Text;
22722277

22732278
if not Doc_Text.Is_Empty then
2274-
Loc_Text.Append
2275-
(VSS.Strings.To_Virtual_String
2276-
((1 .. 2 => Ada.Characters.Wide_Wide_Latin_1.LF)));
2277-
2279+
Loc_Text.Append (2 * VSS.Characters.Latin.Line_Feed);
22782280
Loc_Text.Append (Doc_Text);
22792281
end if;
22802282

source/ada/lsp-ada_handlers-project_loading.adb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18-
with Ada.Characters.Wide_Wide_Latin_1;
19-
2018
with GNATCOLL.Traces;
2119
with GNATCOLL.VFS;
2220

@@ -31,6 +29,7 @@ with GPR2.Project.Tree.View_Builder;
3129

3230
with Libadalang.Preprocessing;
3331

32+
with VSS.Characters.Latin;
3433
with VSS.Strings.Conversions;
3534
with VSS.String_Vectors;
3635

@@ -47,9 +46,6 @@ with URIs;
4746

4847
package body LSP.Ada_Handlers.Project_Loading is
4948

50-
Line_Feed : constant Wide_Wide_Character :=
51-
Ada.Characters.Wide_Wide_Latin_1.LF;
52-
5349
Runtime_Indexing : constant GNATCOLL.Traces.Trace_Handle :=
5450
GNATCOLL.Traces.Create ("ALS.RUNTIME_INDEXING",
5551
GNATCOLL.Traces.On);
@@ -129,8 +125,11 @@ package body LSP.Ada_Handlers.Project_Loading is
129125
---------------------------
130126

131127
procedure Ensure_Project_Loaded (Self : in out Message_Handler'Class) is
128+
use type VSS.Strings.Virtual_String;
129+
132130
GPRs_Found : Natural := 0;
133131
Project_File : VSS.Strings.Virtual_String;
132+
134133
begin
135134
if not Self.Contexts.Is_Empty then
136135
-- Rely on the fact that there is at least one context initialized
@@ -196,10 +195,11 @@ package body LSP.Ada_Handlers.Project_Loading is
196195

197196
Self.Sender.On_ShowMessage_Notification
198197
((a_type => LSP.Enumerations.Error,
199-
message => VSS.Strings.To_Virtual_String
200-
("More than one .gpr found." & Line_Feed &
201-
"Note: you can configure a project " &
202-
" through the ada.projectFile setting.")));
198+
message =>
199+
"More than one .gpr found."
200+
& VSS.Characters.Latin.Line_Feed
201+
& "Note: you can configure a project "
202+
& " through the ada.projectFile setting."));
203203

204204
Load_Implicit_Project (Self, Multiple_Projects_Found);
205205
end if;

0 commit comments

Comments
 (0)