Skip to content

Commit 75063ee

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents 3a80b47 + dee1b1e commit 75063ee

28 files changed

+475
-142
lines changed

scripts/io_gen.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@
293293
294294
with Interfaces;
295295
296-
with VSS.JSON.Streams.Readers;
297296
with VSS.Strings.Conversions;
298297
299298
with LSP.JSON_Streams;

source/ada/lsp-ada_completions.adb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
------------------------------------------------------------------------------
1717

1818
with Ada.Containers.Hashed_Sets;
19+
with Langkit_Support;
1920

2021
with VSS.Strings;
2122

@@ -25,15 +26,16 @@ with LSP.Lal_Utils;
2526

2627
package body LSP.Ada_Completions is
2728

28-
--------------
29-
-- Is_Equal --
30-
--------------
29+
------------------------
30+
-- Is_Full_Sloc_Equal --
31+
------------------------
3132

32-
function Is_Equal (Left, Right : Libadalang.Analysis.Defining_Name)
33-
return Boolean is
33+
function Is_Full_Sloc_Equal
34+
(Left, Right : Libadalang.Analysis.Defining_Name) return Boolean is
3435
begin
35-
return Libadalang.Analysis."=" (Left, Right);
36-
end Is_Equal;
36+
return Libadalang.Analysis.Full_Sloc_Image
37+
(Left) = Libadalang.Analysis.Full_Sloc_Image (Right);
38+
end Is_Full_Sloc_Equal;
3739

3840
-----------------------
3941
-- Write_Completions --

source/ada/lsp-ada_completions.ads

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
-- This package provides types to support completions in Ada Language server.
1919

2020
with Ada.Containers.Hashed_Maps;
21+
with Ada.Strings.Hash_Case_Insensitive;
2122

2223
with Langkit_Support.Slocs;
24+
with Langkit_Support.Text;
2325
with Libadalang.Analysis;
2426
with Libadalang.Common;
2527

@@ -32,12 +34,14 @@ package LSP.Ada_Completions is
3234

3335
function Hash (Name : Libadalang.Analysis.Defining_Name)
3436
return Ada.Containers.Hash_Type is
35-
(Name.As_Ada_Node.Hash);
37+
(Ada.Strings.Hash_Case_Insensitive (
38+
Langkit_Support.Text.To_UTF8 (Name.Full_Sloc_Image)));
3639

37-
function Is_Equal (Left, Right : Libadalang.Analysis.Defining_Name)
38-
return Boolean;
39-
-- This custom Is_Equal function is here as a temporary workaround.
40-
-- The ticket for the corresponding compiler bug is T806-020.
40+
function Is_Full_Sloc_Equal
41+
(Left, Right : Libadalang.Analysis.Defining_Name) return Boolean;
42+
-- Compare the two nodes using full sloc image (filename + sloc). Needed
43+
-- for completion, since LAL can return several times the same declaration
44+
-- and specially subprograms from generic instantiations.
4145

4246
type Name_Information is record
4347
Is_Dot_Call : Boolean;
@@ -59,7 +63,7 @@ package LSP.Ada_Completions is
5963
(Key_Type => Libadalang.Analysis.Defining_Name,
6064
Element_Type => Name_Information,
6165
Hash => Hash,
62-
Equivalent_Keys => Is_Equal,
66+
Equivalent_Keys => Is_Full_Sloc_Equal,
6367
"=" => "=");
6468

6569
type Completion_Provider is abstract tagged limited null record;

source/client/lsp-clients.adb

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

18-
with VSS.JSON.Streams.Readers.Simple;
18+
with VSS.JSON.Pull_Readers.Simple;
1919
with VSS.Stream_Element_Vectors.Conversions;
2020
with VSS.Strings.Conversions;
2121
with VSS.Text_Streams.Memory_UTF8_Input;
@@ -602,9 +602,9 @@ package body LSP.Clients is
602602
Method : out LSP.Types.Optional_String;
603603
Is_Error : in out Boolean)
604604
is
605-
use all type VSS.JSON.Streams.Readers.JSON_Event_Kind;
605+
use all type VSS.JSON.Pull_Readers.JSON_Event_Kind;
606606

607-
R : aliased VSS.JSON.Streams.Readers.Simple.JSON_Simple_Reader;
607+
R : aliased VSS.JSON.Pull_Readers.Simple.JSON_Simple_Pull_Reader;
608608
JS : aliased LSP.JSON_Streams.JSON_Stream (False, R'Access);
609609

610610
begin
@@ -655,7 +655,7 @@ package body LSP.Clients is
655655
Memory.Rewind;
656656
end Look_Ahead;
657657

658-
Reader : aliased VSS.JSON.Streams.Readers.Simple.JSON_Simple_Reader;
658+
Reader : aliased VSS.JSON.Pull_Readers.Simple.JSON_Simple_Pull_Reader;
659659
Stream : aliased LSP.JSON_Streams.JSON_Stream
660660
(Is_Server_Side => False, R => Reader'Unchecked_Access);
661661
Id : LSP.Types.LSP_Number_Or_String;

source/codec_test/codec_test.adb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ with GNATCOLL.JSON;
3232
with VSS.Stream_Element_Vectors.Conversions;
3333
with VSS.Text_Streams.Memory_UTF8_Input;
3434
with VSS.Text_Streams.Memory_UTF8_Output;
35-
with VSS.JSON.Streams.Readers.Simple;
35+
with VSS.JSON.Pull_Readers.Simple;
3636

3737
procedure Codec_Test is
3838

@@ -85,8 +85,8 @@ procedure Codec_Test is
8585
is
8686
Text_Input : aliased
8787
VSS.Text_Streams.Memory_UTF8_Input.Memory_UTF8_Input_Stream;
88-
Reader : aliased VSS.JSON.Streams.Readers
89-
.Simple.JSON_Simple_Reader;
88+
Reader : aliased
89+
VSS.JSON.Pull_Readers.Simple.JSON_Simple_Pull_Reader;
9090
In_JS : aliased LSP.JSON_Streams.JSON_Stream (False, Reader'Access);
9191
begin
9292
Text_Input.Set_Data (Input);

source/protocol/generated/lsp-message_io.adb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
with Interfaces;
44

5-
with VSS.JSON.Streams.Readers;
65
with VSS.Strings.Conversions;
76

87
with LSP.JSON_Streams;
@@ -7537,6 +7536,8 @@ package body LSP.Message_IO is
75377536
Optional_ProgressToken'Read (S, V.partialResultToken);
75387537
elsif Key = "textDocument" then
75397538
TextDocumentIdentifier'Read (S, V.textDocument);
7539+
elsif Key = "query" then
7540+
LSP.Types.Read (S, V.query);
75407541
elsif Key = "case_sensitive" then
75417542
Optional_Boolean'Read (S, V.case_sensitive);
75427543
elsif Key = "whole_word" then
@@ -7567,6 +7568,8 @@ package body LSP.Message_IO is
75677568
Optional_ProgressToken'Write (S, V.partialResultToken);
75687569
JS.Key ("textDocument");
75697570
TextDocumentIdentifier'Write (S, V.textDocument);
7571+
JS.Key ("query");
7572+
LSP.Types.Write (S, V.query);
75707573
JS.Key ("case_sensitive");
75717574
Optional_Boolean'Write (S, V.case_sensitive);
75727575
JS.Key ("whole_word");

source/protocol/lsp-generic_notifications.adb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2020, AdaCore --
4+
-- Copyright (C) 2018-2021, 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,7 +15,6 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18-
with VSS.JSON.Streams.Readers;
1918
with VSS.Strings.Conversions;
2019

2120
with LSP.Types;

source/protocol/lsp-generic_optional.adb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2019, AdaCore --
4+
-- Copyright (C) 2018-2021, 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,8 +15,6 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18-
with VSS.JSON.Streams.Readers;
19-
2018
with LSP.JSON_Streams;
2119

2220
package body LSP.Generic_Optional is

source/protocol/lsp-generic_requests.adb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2020, AdaCore --
4+
-- Copyright (C) 2018-2021, 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,12 +15,11 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with VSS.Strings.Conversions;
19+
1820
with LSP.Messages.Common_Writers;
1921
with LSP.Types;
2022

21-
with VSS.JSON.Streams.Readers;
22-
with VSS.Strings.Conversions;
23-
2423
package body LSP.Generic_Requests is
2524

2625
------------

source/protocol/lsp-generic_responses.adb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2019, AdaCore --
4+
-- Copyright (C) 2018-2021, 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,7 +15,6 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18-
with VSS.JSON.Streams.Readers;
1918
with VSS.Strings.Conversions;
2019

2120
with LSP.JSON_Streams;

0 commit comments

Comments
 (0)