Skip to content

Commit f077994

Browse files
committed
Merge branch 'topic/vadim/transformations' into 'master'
Update to use new API. See merge request eng/ide/ada_language_server!1476
2 parents 1f93946 + 52c8316 commit f077994

5 files changed

+24
-17
lines changed

source/ada/lsp-ada_completions-generic_assoc.adb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2022-2023, AdaCore --
4+
-- Copyright (C) 2022-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -23,6 +23,7 @@ with LSP.Ada_Documents;
2323
with LSP.Enumerations;
2424
with VSS.Strings.Character_Iterators;
2525
with VSS.Strings.Conversions;
26+
with VSS.Transformers.Caseless;
2627
with VSS.Unicode;
2728

2829
pragma Warnings (Off, "is not referenced");
@@ -265,7 +266,7 @@ package body LSP.Ada_Completions.Generic_Assoc is
265266
or else
266267
Name.Starts_With
267268
(Completion_Prefix,
268-
VSS.Strings.Identifier_Caseless)
269+
VSS.Transformers.Caseless.To_Identifier_Caseless)
269270
then
270271
-- Snippet Format: "Name => "
271272
Item.label := Name;

source/ada/lsp-ada_completions-keywords.adb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2021, AdaCore --
4+
-- Copyright (C) 2018-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -19,6 +19,7 @@ with Ada.Strings.Wide_Wide_Unbounded;
1919
with Libadalang.Common;
2020

2121
with VSS.Strings;
22+
with VSS.Transformers.Caseless;
2223

2324
with LSP.Ada_Completions.Filters;
2425
with LSP.Enumerations;
@@ -72,7 +73,7 @@ package body LSP.Ada_Completions.Keywords is
7273

7374
begin
7475
if Label.Starts_With
75-
(Prefix, VSS.Strings.Identifier_Caseless)
76+
(Prefix, VSS.Transformers.Caseless.To_Identifier_Caseless)
7677
then
7778
Item.label := Label;
7879
Item.insertTextFormat := (True, LSP.Enumerations.PlainText);

source/ada/lsp-ada_completions-names.adb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2021, AdaCore --
4+
-- Copyright (C) 2018-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -18,6 +18,7 @@
1818
with Langkit_Support.Errors;
1919

2020
with VSS.Strings;
21+
with VSS.Transformers.Caseless;
2122

2223
with LSP.Ada_Completions.Filters;
2324

@@ -185,7 +186,8 @@ package body LSP.Ada_Completions.Names is
185186
elsif Dotted_Node.Kind in
186187
Libadalang.Common.Ada_Dotted_Name_Range
187188
or else Name.Starts_With
188-
(Prefix, VSS.Strings.Identifier_Caseless)
189+
(Prefix,
190+
VSS.Transformers.Caseless.To_Identifier_Caseless)
189191
then
190192
Completion_Count := Completion_Count + 1;
191193

source/ada/lsp-predefined_completion.adb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2020-2021, AdaCore --
4+
-- Copyright (C) 2020-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,6 +25,7 @@ with GNATCOLL.VFS; use GNATCOLL.VFS;
2525
with GNATCOLL.Utils;
2626

2727
with VSS.Strings.Conversions;
28+
with VSS.Transformers.Caseless;
2829

2930
with LSP.Enumerations;
3031
with LSP.Predefined_Completion.Ada2012;
@@ -201,7 +202,7 @@ package body LSP.Predefined_Completion is
201202
begin
202203
for Item of Items loop
203204
if Item.label.Starts_With
204-
(Prefix, VSS.Strings.Identifier_Caseless)
205+
(Prefix, VSS.Transformers.Caseless.To_Identifier_Caseless)
205206
then
206207
Result.Append (Item);
207208
end if;

source/ada/lsp-search-start_word.adb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2021-2023, AdaCore --
4+
-- Copyright (C) 2021-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -15,6 +15,8 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with VSS.Transformers.Caseless; use VSS.Transformers.Caseless;
19+
1820
package body LSP.Search.Start_Word is
1921

2022
-----------
@@ -54,15 +56,15 @@ package body LSP.Search.Start_Word is
5456
overriding function Match
5557
(Self : Start_Word_Search;
5658
Text : VSS.Strings.Virtual_String)
57-
return Boolean
58-
is
59-
Kind : constant array (Boolean) of VSS.Strings.Case_Sensitivity :=
60-
[False => VSS.Strings.Identifier_Caseless,
61-
True => VSS.Strings.Case_Sensitive];
62-
59+
return Boolean is
6360
begin
64-
return Text.Starts_With (Self.Text, Kind (Self.Case_Sensitive))
65-
xor Self.Negate;
61+
case Self.Case_Sensitive is
62+
when False =>
63+
return Text.Starts_With (Self.Text, To_Identifier_Caseless)
64+
xor Self.Negate;
65+
when True =>
66+
return Text.Starts_With (Self.Text) xor Self.Negate;
67+
end case;
6668
end Match;
6769

6870
end LSP.Search.Start_Word;

0 commit comments

Comments
 (0)