Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic-merge committed Dec 8, 2023
2 parents d16dc8b + 2b9a25f commit ffbd88d
Show file tree
Hide file tree
Showing 11 changed files with 484 additions and 20 deletions.
5 changes: 4 additions & 1 deletion source/ada/lsp-ada_handlers-refactor-auto_import.adb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ package body LSP.Ada_Handlers.Refactor.Auto_Import is
use Ada.Strings.Wide_Wide_Unbounded;

Title : constant Langkit_Support.Text.Unbounded_Text_Type :=
"Qualify with " & Suggestion.Qualifier;
(if Suggestion.Qualifier = Null_Unbounded_Wide_Wide_String then
"Import from " & Suggestion.Import
else
"Qualify with " & Suggestion.Qualifier);
begin
return
VSS.Strings.To_Virtual_String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[
{
"comment": ["Test codeaction import refactor"]
"comment": [
"Test codeaction import refactor"
]
},
{
"start": {
"cmd": ["${ALS}"]
"cmd": [
"${ALS}"
]
}
},
{
Expand Down Expand Up @@ -32,12 +36,22 @@
"referencesProvider": true,
"textDocumentSync": 2,
"completionProvider": {
"triggerCharacters": [".", ",", "'", "("],
"triggerCharacters": [
".",
",",
"'",
"("
],
"resolveProvider": true
},
"signatureHelpProvider": {
"triggerCharacters": [",", "("],
"retriggerCharacters": ["\b"]
"triggerCharacters": [
",",
"("
],
"retriggerCharacters": [
"\b"
]
},
"definitionProvider": true
}
Expand Down Expand Up @@ -491,19 +505,6 @@
}
},
"newText": "with Foo;\n"
},
{
"range": {
"start": {
"line": 9,
"character": 20
},
"end": {
"line": 9,
"character": 20
}
},
"newText": ""
}
]
}
Expand Down Expand Up @@ -617,4 +618,4 @@
"exit_code": 0
}
}
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package body A is

procedure Subprogram is
begin
null;
end Subprogram;

end A;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package A is

procedure Subprogram;

end A;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project Default is
for Main use ("main.adb");
for Runtime ("Ada") use "./rts-empty";
end Default;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
with A;

package E renames A;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
procedure Main is
begin
A.Subprogram;
end Main;
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
[
{
"comment": [
"This test checks if imports (with clause + prefix) are being suggested to unresolved names."
]
},
{
"start": {
"cmd": ["${ALS}"]
}
},
{
"send": {
"request": {
"params": {
"processId": 13950,
"capabilities": {
"workspace": {
"workspaceEdit": {
"documentChanges": true
},
"applyEdit": false
}
},
"rootUri": "$URI{.}"
},
"jsonrpc": "2.0",
"id": 1,
"method": "initialize"
},
"wait": [
{
"id": 1,
"result": {
"capabilities": {
"textDocumentSync": 2,
"executeCommandProvider": {
"commands": ["<HAS>", "als-auto-import"]
}
}
}
}
]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"method": "initialized"
},
"wait": []
}
},
{
"send": {
"request": {
"params": {
"settings": {
"ada": {
"projectFile": "default.gpr",
"scenarioVariables": {},
"defaultCharset": "ISO-8859-1"
}
}
},
"jsonrpc": "2.0",
"method": "workspace/didChangeConfiguration"
},
"wait": [
{
"jsonrpc": "2.0",
"id": 1,
"method": "window/workDoneProgress/create",
"params": {
"token": "<ANY>"
}
},
{
"jsonrpc": "2.0",
"method": "$/progress",
"params": {
"token": "<ANY>",
"value": {
"kind": "end"
}
}
}
]
}
},
{
"send": {
"request": {
"params": {
"textDocument": {
"text": "procedure Main is\nbegin\n A.Subprogram;\nend Main;",
"version": 0,
"uri": "$URI{main.adb}",
"languageId": "Ada"
}
},
"jsonrpc": "2.0",
"method": "textDocument/didOpen"
},
"wait": []
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/codeAction",
"params": {
"textDocument": {
"uri": "$URI{main.adb}"
},
"range": {
"start": {
"line": 2,
"character": 3
},
"end": {
"line": 2,
"character": 3
}
},
"context": {
"diagnostics": []
}
}
},
"wait": [
{
"jsonrpc": "2.0",
"id": 2,
"result": [
{
"title": "Import from A",
"kind": "quickfix",
"command": {
"title": "",
"command": "als-auto-import",
"arguments": [
{
"context": "Default",
"where": {
"textDocument": {
"uri": "$URI{main.adb}"
},
"position": {
"line": 2,
"character": 5
}
},
"import": "A",
"qualifier": ""
}
]
}
},
{
"title": "Qualify with E",
"kind": "quickfix",
"command": {
"title": "",
"command": "als-auto-import",
"arguments": [
{
"context": "Default",
"where": {
"textDocument": {
"uri": "$URI{main.adb}"
},
"position": {
"line": 2,
"character": 5
}
},
"import": "E",
"qualifier": "E"
}
]
}
}
]
}
]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"id": 3,
"method": "workspace/executeCommand",
"params": {
"command": "als-auto-import",
"arguments": [
{
"context": "Default",
"where": {
"textDocument": {
"uri": "$URI{main.adb}"
},
"position": {
"line": 2,
"character": 3
}
},
"import": "A",
"qualifier": ""
}
]
}
},
"wait": [
{
"jsonrpc": "2.0",
"id": 2,
"method": "workspace/applyEdit",
"params": {
"edit": {
"documentChanges": [
{
"textDocument": {
"uri": "$URI{main.adb}",
"version": 1
},
"edits": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"newText": "with A;\n"
}
]
}
]
}
}
}
]
}
},
{
"stop": {
"exit_code": 0
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------

package Ada is
pragma No_Elaboration_Code_All;
pragma Pure;

end Ada;
Loading

0 comments on commit ffbd88d

Please sign in to comment.