Skip to content

Commit c672051

Browse files
committed
Merge branch 'topic/show_deps' into 'master'
Replace `textDocument/alsShowDependencies` request See merge request eng/ide/ada_language_server!1397
2 parents 6150138 + 17f8bb1 commit c672051

39 files changed

+444
-6854
lines changed

doc/show_dependencies.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ a given unit.
88

99
## Capabilities
1010

11-
The `initialize` request returns a boolean `alsShowDepsProvider` as part of
12-
the `capabilities`, set to true if the server supports this functionality.
11+
The `initialize` request returns `als-show-dependencies` in the list of
12+
supported commands if the server supports this functionality.
1313

1414
## Change description
1515

@@ -23,7 +23,7 @@ export namespace ALS_ShowDependenciesKind {
2323
}
2424

2525
interface ALS_ShowDependenciesParams {
26-
textDocument : TextDocumentIdentifier; /* The queried unit */
26+
uri : DocumentUri; /* The queried unit */
2727
kind : ALS_ShowDependenciesKind; /* The dependencies query kind */
2828
showImplicit : boolean; /* True if implicit dependencies should be returned */
2929
}
@@ -34,15 +34,16 @@ interface ALS_Unit_Description {
3434
}
3535
```
3636

37-
And a new request:
37+
And a new command `als-show-dependencies`:
3838

39-
method: `textDocument/alsShowDependencies`
40-
params: `ALS_ShowDependenciesParams`
39+
method: `workspace/executeCommand`
40+
"params": {
41+
"command": "als-show-dependencies",
42+
"arguments": [
43+
<ALS_ShowDependenciesParams>
44+
]
45+
}
4146

42-
Returning the references to the method identified at the given position:
47+
It returns list of `ALS_Unit_Description`:
4348

4449
result: `ALS_Unit_Description[]`
45-
46-
We also introduce a new boolean field `ALS_showDepsProvider` in the
47-
interface `ServerCapabilities` indicating whether the server supports
48-
this extension.

gnat/ignore_in_317.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

gnat/lsp_server.gpr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,11 @@ project LSP_Server is
4040

4141
for Source_Dirs use
4242
("../source/server",
43-
"../source/server/generated",
4443
"../source/ada",
4544
"../source/gpr",
4645
"../source/ada/generated",
4746
"../source/memory");
4847

49-
for Excluded_Source_Dirs use
50-
("../source/server/generated");
51-
52-
for Excluded_Source_List_File use "ignore_in_317.txt";
53-
5448
for Object_Dir use "../.obj/server";
5549
for Main use ("lsp-ada_driver.adb");
5650

source/ada/lsp-ada_commands.ads

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ package LSP.Ada_Commands is
4141
return Command is abstract;
4242

4343
procedure Execute
44-
(Self : Command;
45-
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
46-
Error : in out LSP.Errors.ResponseError_Optional) is abstract;
44+
(Self : Command;
45+
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
46+
Response : in out LSP.Structures.LSPAny_Or_Null;
47+
Error : in out LSP.Errors.ResponseError_Optional) is abstract;
4748
-- Execute given command and return Error is something went wrong.
4849
-- Commands are executed on the server side only.
4950
-- The Handler is the access to the message handler executing the command.

source/ada/lsp-ada_driver.adb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ with LSP.Ada_Handlers.Refactor.Remove_Parameter;
5555
with LSP.Ada_Handlers.Refactor.Replace_Type;
5656
with LSP.Ada_Handlers.Refactor.Sort_Dependencies;
5757
with LSP.Ada_Handlers.Refactor.Suppress_Seperate;
58+
with LSP.Ada_Handlers.Show_Dependencies_Commands;
5859
with LSP.Ada_Handlers.Suspend_Executions;
5960
with LSP.GNATCOLL_Trace_Streams;
6061
with LSP.GNATCOLL_Tracers;
@@ -88,6 +89,8 @@ procedure LSP.Ada_Driver is
8889
(LSP.Ada_Handlers.Suspend_Executions.Suspend_Execution'Tag);
8990
LSP.Ada_Commands.Register
9091
(LSP.Ada_Handlers.Project_Reload_Commands.Command'Tag);
92+
LSP.Ada_Commands.Register
93+
(LSP.Ada_Handlers.Show_Dependencies_Commands.Command'Tag);
9194
LSP.Ada_Commands.Register
9295
(LSP.Ada_Handlers.Named_Parameters_Commands.Command'Tag);
9396
LSP.Ada_Commands.Register

source/ada/lsp-ada_handlers-named_parameters_commands.adb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,12 @@ package body LSP.Ada_Handlers.Named_Parameters_Commands is
145145
-------------
146146

147147
overriding procedure Execute
148-
(Self : Command;
149-
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
150-
Error : in out LSP.Errors.ResponseError_Optional)
148+
(Self : Command;
149+
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
150+
Response : in out LSP.Structures.LSPAny_Or_Null;
151+
Error : in out LSP.Errors.ResponseError_Optional)
151152
is
153+
pragma Unreferenced (Response);
152154
use LSP.Structures;
153155

154156
procedure Append
@@ -159,9 +161,6 @@ package body LSP.Ada_Handlers.Named_Parameters_Commands is
159161
Apply : LSP.Structures.ApplyWorkspaceEditParams;
160162
Edits : LSP.Structures.WorkspaceEdit renames Apply.edit;
161163

162-
Message_Handler : LSP.Ada_Handlers.Message_Handler renames
163-
LSP.Ada_Handlers.Message_Handler (Handler.all);
164-
165164
------------
166165
-- Append --
167166
------------
@@ -201,10 +200,10 @@ package body LSP.Ada_Handlers.Named_Parameters_Commands is
201200
end Append;
202201

203202
Context : LSP.Ada_Contexts.Context renames
204-
Message_Handler.Contexts.Get (Self.Context).all;
203+
Handler.Contexts.Get (Self.Context).all;
205204

206205
Document : constant LSP.Ada_Documents.Document_Access :=
207-
Message_Handler.Get_Open_Document (Self.Where.textDocument.uri);
206+
Handler.Get_Open_Document (Self.Where.textDocument.uri);
208207

209208
Node : Libadalang.Analysis.Ada_Node :=
210209
Document.Get_Node_At (Context, Self.Where.position);

source/ada/lsp-ada_handlers-named_parameters_commands.ads

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ private
5252
return Command;
5353

5454
overriding procedure Execute
55-
(Self : Command;
56-
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
57-
Error : in out LSP.Errors.ResponseError_Optional);
55+
(Self : Command;
56+
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
57+
Response : in out LSP.Structures.LSPAny_Or_Null;
58+
Error : in out LSP.Errors.ResponseError_Optional);
5859

5960
function Write_Command
6061
(Self : Command) return LSP.Structures.LSPAny_Vector;

source/ada/lsp-ada_handlers-other_file_commands.adb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ package body LSP.Ada_Handlers.Other_File_Commands is
7474
-------------
7575

7676
overriding procedure Execute
77-
(Self : Command;
78-
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
79-
Error : in out LSP.Errors.ResponseError_Optional)
77+
(Self : Command;
78+
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
79+
Response : in out LSP.Structures.LSPAny_Or_Null;
80+
Error : in out LSP.Errors.ResponseError_Optional)
8081
is
82+
pragma Unreferenced (Response);
8183
File : constant GNATCOLL.VFS.Virtual_File :=
8284
Handler.To_File (Self.URI);
8385

source/ada/lsp-ada_handlers-other_file_commands.ads

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ private
3939
return Command;
4040

4141
overriding procedure Execute
42-
(Self : Command;
43-
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
44-
Error : in out LSP.Errors.ResponseError_Optional);
42+
(Self : Command;
43+
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
44+
Response : in out LSP.Structures.LSPAny_Or_Null;
45+
Error : in out LSP.Errors.ResponseError_Optional);
4546

4647
for Command'External_Tag use "als-other-file";
4748

source/ada/lsp-ada_handlers-project_reload_commands.adb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ package body LSP.Ada_Handlers.Project_Reload_Commands is
3737
-------------
3838

3939
overriding procedure Execute
40-
(Self : Command;
41-
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
42-
Error : in out LSP.Errors.ResponseError_Optional) is
40+
(Self : Command;
41+
Handler : not null access LSP.Ada_Handlers.Message_Handler'Class;
42+
Response : in out LSP.Structures.LSPAny_Or_Null;
43+
Error : in out LSP.Errors.ResponseError_Optional)
44+
is
45+
pragma Unreferenced (Response);
4346
begin
4447
LSP.Ada_Handlers.Project_Loading.Reload_Project (Handler.all);
4548
end Execute;

0 commit comments

Comments
 (0)