Skip to content

Commit fe6d77d

Browse files
Merge branch 'topic/eng/ide/ada_language_server#1391' into 'master'
Return all workspace symbols on empty strings See merge request eng/ide/ada_language_server!1630
2 parents 52a5dc1 + 45d87ce commit fe6d77d

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

source/ada/lsp-ada_contexts.ads

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,11 @@ package LSP.Ada_Contexts is
248248
Stop : in out Boolean);
249249
Unit_Prefix : VSS.Strings.Virtual_String :=
250250
VSS.Strings.Empty_Virtual_String);
251-
-- Find symbols starting with given Prefix in all files of the context and
252-
-- call Callback for each. Name could contain a stale reference if the File
251+
-- Find symbols that match the given Pattern in all files of the context and
252+
-- call Callback for each.
253+
-- If Pattern is an empty string, all the symbols in all files will be
254+
-- returned.
255+
-- Name could contain a stale reference if the File
253256
-- was updated since last indexing operation. If Only_Public is True it
254257
-- will skip any "private" symbols (like symbols in private part or body).
255258
-- Unit_Prefix is used for additional filtering: when specified, only the

source/ada/lsp-ada_file_sets.adb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,14 @@ package body LSP.Ada_File_Sets is
146146
-- Match each element individually because
147147
-- All_Symbols is case insensitive
148148
for Item of Self.All_Symbols (Cursor) loop
149-
Defining_Name := Get_Defining_Name (Item.File, Item.Loc);
150-
151-
if not Defining_Name.Is_Null
152-
and then Pattern.Match
153-
(VSS.Strings.To_Virtual_String
154-
(Defining_Name.As_Ada_Node.Text))
149+
Defining_Name :=
150+
Get_Defining_Name (Item.File, Item.Loc);
151+
152+
if not Defining_Name.Is_Null and then
153+
(Pattern.Get_Canonical_Pattern.Is_Empty
154+
or else Pattern.Match
155+
(VSS.Strings.To_Virtual_String
156+
(Defining_Name.As_Ada_Node.Text)))
155157
then
156158
if not Only_Public or else Item.Is_Public then
157159
Callback (Item.File, Defining_Name, Stop);
@@ -161,12 +163,16 @@ package body LSP.Ada_File_Sets is
161163
end if;
162164
end loop;
163165

164-
elsif Pattern.Match (Symbol_Maps.Key (Cursor)) then
166+
elsif
167+
Pattern.Get_Canonical_Pattern.Is_Empty
168+
or else Pattern.Match (Symbol_Maps.Key (Cursor))
169+
then
165170
-- All_Symbols is case insensitive so if the key is matched
166171
-- this means that all elements are also matched the pattern
167172
for Item of Self.All_Symbols (Cursor) loop
168173
if not Only_Public or else Item.Is_Public then
169-
Defining_Name := Get_Defining_Name (Item.File, Item.Loc);
174+
Defining_Name :=
175+
Get_Defining_Name (Item.File, Item.Loc);
170176
if not Defining_Name.Is_Null
171177
and then Matches_Unit_Prefix (Defining_Name)
172178
then

source/ada/lsp-ada_file_sets.ads

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ package LSP.Ada_File_Sets is
8888
Stop : in out Boolean);
8989
Unit_Prefix : VSS.Strings.Virtual_String :=
9090
VSS.Strings.Empty_Virtual_String);
91-
-- Find symbols starting with given Prefix in all files of the set and
92-
-- call Callback for each. Get_Defining_Name callback is used for getting
91+
-- Find symbols that match the given Pattern in all files of the set and
92+
-- call Callback for each.
93+
-- If Pattern is an empty string, all the symbols in all files will be
94+
-- returned.
95+
-- Get_Defining_Name callback is used for getting
9396
-- the Defining_Name at the given location Loc in a unit.
9497
-- Name could contain a stale reference if the File was updated since
9598
-- last indexing operation. If Only_Public is True it will skip any

0 commit comments

Comments
 (0)