Skip to content

Commit 7d6bbfe

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents 257e79c + b7f102b commit 7d6bbfe

File tree

9 files changed

+46
-45
lines changed

9 files changed

+46
-45
lines changed

integration/vscode/ada/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@
245245
},
246246
"scripts": {
247247
"vscode:prepublish": "npm run compile",
248-
"compile": "./node_modules/typescript/bin/tsc",
249-
"watch": "./node_modules/typescript/bin/tsc -watch",
248+
"compile": "node ./node_modules/typescript/bin/tsc",
249+
"watch": "node ./node_modules/typescript/bin/tsc -watch",
250250
"pretest": "npm run compile",
251251
"lint": "eslint './src/**/*.{js,ts,tsx}' --quiet --fix",
252252
"test": "node ./out/test/runTest.js"

source/ada/lsp-ada_contexts.adb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,10 @@ package body LSP.Ada_Contexts is
781781
-----------------
782782

783783
function Get_Node_At
784-
(Self : Context;
785-
Document : LSP.Ada_Documents.Document_Access;
786-
Position : LSP.Messages.TextDocumentPositionParams'Class)
784+
(Self : Context;
785+
Document : LSP.Ada_Documents.Document_Access;
786+
Position : LSP.Messages.TextDocumentPositionParams'Class;
787+
Project_Only : Boolean := True)
787788
return Libadalang.Analysis.Ada_Node
788789
is
789790
use type Libadalang.Analysis.Ada_Node;
@@ -801,12 +802,13 @@ package body LSP.Ada_Contexts is
801802
-- We're about to get a node from an analysis unit. Either the document
802803
-- is open for it, in which case we read the document, or the
803804
-- document is not open for it. In this case, resolve this only
804-
-- if the file belongs to the project: we don't want to pollute the
805-
-- LAL context with units that are not in the project.
805+
-- if the file belongs to the project (unless if Project_Only is False):
806+
-- we don't want to pollute the LAL context with units that are not in
807+
-- the project.
806808

807809
if Document /= null then
808810
return Document.Get_Node_At (Self, Position.position);
809-
elsif Self.Is_Part_Of_Project (File) then
811+
elsif not Project_Only or else Self.Is_Part_Of_Project (File) then
810812
Unit := Self.LAL_Context.Get_From_File
811813
(Name,
812814
Charset => Self.Get_Charset);

source/ada/lsp-ada_contexts.ads

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ package LSP.Ada_Contexts is
8383
return Ada.Strings.UTF_Encoding.UTF_8_String;
8484

8585
function Get_Node_At
86-
(Self : Context;
87-
Document : LSP.Ada_Documents.Document_Access;
88-
Position : LSP.Messages.TextDocumentPositionParams'Class)
86+
(Self : Context;
87+
Document : LSP.Ada_Documents.Document_Access;
88+
Position : LSP.Messages.TextDocumentPositionParams'Class;
89+
Project_Only : Boolean := True)
8990
return Libadalang.Analysis.Ada_Node;
9091
-- Return the node at the given location.
9192
-- If Document is not null, get the location from the document, otherwise
92-
-- get it from the file.
93+
-- get it from the file if it belongs to the context's project when
94+
-- Project_Only is True.
9395

9496
procedure Format
9597
(Self : in out Context;

source/ada/lsp-ada_documents.ads

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ package LSP.Ada_Documents is
148148
Limit : Ada.Containers.Count_Type;
149149
Only_Public : Boolean;
150150
Canceled : access function return Boolean;
151-
Result : in out LSP.Ada_Completions.Completion_Maps.Map);
151+
Result : in out LSP.Ada_Completions.Completion_Maps.Map);
152152
-- See Contexts.Get_Any_Symbol
153153

154154
procedure Get_Folding_Blocks

source/ada/lsp-ada_handlers-invisibles.adb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ package body LSP.Ada_Handlers.Invisibles is
138138

139139
for Doc of Self.Handler.Open_Documents loop
140140
Doc.Get_Any_Symbol
141-
(Self.Context.all,
142-
Pattern,
143-
Limit,
144-
True,
145-
Dummy_Canceled'Access,
146-
Names);
141+
(Context => Self.Context.all,
142+
Pattern => Pattern,
143+
Limit => Limit,
144+
Only_Public => True,
145+
Canceled => Dummy_Canceled'Access,
146+
Result => Names);
147147
end loop;
148148
end;
149149
end if;

source/ada/lsp-ada_handlers.adb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,14 +3766,17 @@ package body LSP.Ada_Handlers is
37663766
Request : LSP.Messages.Server_Requests.Workspace_Symbols_Request)
37673767
return LSP.Messages.Server_Responses.Symbol_Response
37683768
is
3769+
use type LSP.Messages.Search_Kind;
3770+
use type VSS.Strings.Character_Count;
3771+
37693772
procedure On_Inaccessible_Name
37703773
(File : GNATCOLL.VFS.Virtual_File;
37713774
Name : Libadalang.Analysis.Defining_Name;
37723775
Stop : in out Boolean);
37733776

37743777
Names : LSP.Ada_Completions.Completion_Maps.Map;
37753778

3776-
package Canceled is new LSP.Generic_Cancel_Check (Request, 127);
3779+
package Canceled is new LSP.Generic_Cancel_Check (Request'Access, 127);
37773780

37783781
procedure Write_Symbols is
37793782
new LSP.Ada_Completions.Generic_Write_Symbols
@@ -3818,6 +3821,16 @@ package body LSP.Ada_Handlers is
38183821
(Is_Error => False);
38193822

38203823
begin
3824+
if Pattern.Get_Kind /= LSP.Messages.Start_Word_Text
3825+
and then Pattern.Get_Canonical_Pattern.Character_Length < 2
3826+
then
3827+
-- Do not process too small pattern because
3828+
-- this produces a huge response that is useless
3829+
-- and costs a while.
3830+
3831+
return Response;
3832+
end if;
3833+
38213834
for Context of Self.Contexts.Each_Context loop
38223835
Context.Get_Any_Symbol
38233836
(Pattern => Pattern,
@@ -3968,9 +3981,10 @@ package body LSP.Ada_Handlers is
39683981

39693982
C := Self.Contexts.Get_Best_Context (Item.data.Value.uri);
39703983
Node := Get_Node_At
3971-
(Self => C.all,
3972-
Document => null,
3973-
Position => LSP.Messages.TextDocumentPositionParams'
3984+
(Self => C.all,
3985+
Document => null,
3986+
Project_Only => False,
3987+
Position => LSP.Messages.TextDocumentPositionParams'
39743988
(textDocument => (uri => Item.data.Value.uri),
39753989
position => Item.data.Value.span.first));
39763990

source/server/lsp-generic_cancel_check.ads

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
with LSP.Messages.Server_Requests;
2424

2525
generic
26-
Request : LSP.Messages.Server_Requests.Server_Request'Class;
26+
Request : access constant LSP.Messages.Server_Requests.Server_Request'Class;
2727
-- A request to check cancelation
28+
2829
Max_Skip_Count : Natural;
2930
-- How much checks to skip before make a real atomic flag check
3031

3132
package LSP.Generic_Cancel_Check is
3233

33-
function Has_Been_Canceled return Boolean
34-
with Inline;
34+
function Has_Been_Canceled return Boolean with Inline;
3535

3636
end LSP.Generic_Cancel_Check;

testsuite/ada_lsp/completion.invisible.runtime/test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
}
163163
}
164164
},
165-
"waitFactor": "40",
165+
"waitFactor": "10",
166166
"wait": [
167167
{
168168
"jsonrpc": "2.0",

testsuite/ada_lsp/workspace_symbol/test.json

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,13 @@
7171
"id":"wsSymbol",
7272
"method":"workspace/symbol",
7373
"params":{
74-
"query":""
74+
"query":"Test"
7575
}
7676
},
7777
"sortReply": {"result":"name"},
7878
"wait":[{
7979
"id": "wsSymbol",
8080
"result": [
81-
{
82-
"name": "Main",
83-
"kind": 12,
84-
"location": {
85-
"uri": "$URI{main.adb}",
86-
"range": {
87-
"start": {
88-
"line": 0,
89-
"character": 10
90-
},
91-
"end": {
92-
"line": 0,
93-
"character": 14
94-
}
95-
}
96-
}
97-
},
9881
{
9982
"name": "Test1",
10083
"kind": 12,

0 commit comments

Comments
 (0)