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 Aug 15, 2024
2 parents baafa95 + d5d4bc7 commit e9b14a0
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/ada/lsp-ada_completions-parameters.adb
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,10 @@ package body LSP.Ada_Completions.Parameters is
return Res;
end if;

if Aggr_Type.Kind in Ada_Type_Decl then
if Aggr_Type.Kind in Ada_Type_Decl
and then Aggr_Type.P_Is_Record_Type
-- P_Shapes can only be called on record types
then
declare
Base_Type : constant Base_Type_Decl :=
Aggr_Type.P_Base_Type (Origin => A);
Expand Down
9 changes: 9 additions & 0 deletions testsuite/ada_lsp/completion.aggregates.string/main.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
with Ada.Text_IO;

procedure Main is
A : constant String := (1 .. 0 => 'a');
begin
if A'Last in A'Range then
Ada.Text_IO.Put_Line ("Hello");
end if;
end Main;
3 changes: 3 additions & 0 deletions testsuite/ada_lsp/completion.aggregates.string/test.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project Test is
for Main use ("main.adb");
end Test;
228 changes: 228 additions & 0 deletions testsuite/ada_lsp/completion.aggregates.string/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
[
{
"comment": [
"Test the completion provider inside a string aggregate.",
"No exception should happen."
]
}, {
"start": {
"cmd": [
"${ALS}"
]
}
},
{
"send": {
"request": {
"params": {
"processId": 31570,
"capabilities": {
"textDocument": {
"completion": {
"completionItem": {
"documentationFormat": [
"plaintext",
"markdown"
],
"snippetSupport": true
},
"dynamicRegistration": true
},
"definition": {},
"hover": {},
"formatting": {
"dynamicRegistration": true
},
"implementation": {},
"codeLens": {},
"typeDefinition": {},
"selectionRange": {},
"documentHighlight": {},
"documentSymbol": {
"hierarchicalDocumentSymbolSupport": true
},
"synchronization": {},
"references": {},
"rangeFormatting": {},
"onTypeFormatting": {},
"declaration": {},
"foldingRange": {
"lineFoldingOnly": true
},
"colorProvider": {}
},
"workspace": {
"applyEdit": true,
"executeCommand": {},
"didChangeWatchedFiles": {},
"workspaceEdit": {},
"didChangeConfiguration": {}
}
},
"rootUri": "$URI{.}"
},
"jsonrpc": "2.0",
"id": 1,
"method": "initialize"
},
"wait": [
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"capabilities": {
"textDocumentSync": 2,
"completionProvider": {
"triggerCharacters": [
".",
",",
"'",
"("
],
"resolveProvider": true
}
}
}
}
]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"method": "initialized"
},
"wait": []
}
},
{
"send": {
"request": {
"params": {
"settings": {
"ada": {
"scenarioVariables": {},
"enableDiagnostics": false,
"defaultCharset": "ISO-8859-1"
}
}
},
"jsonrpc": "2.0",
"method": "workspace/didChangeConfiguration"
},
"wait": []
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "$URI{main.adb}",
"languageId": "Ada",
"version": 0,
"text": "with Ada.Text_IO;\n\nprocedure Main is\n A : constant String := (1 .. 0 => 'a');\nbegin\n if A'Last in A'Range then\n Ada.Text_IO.Put_Line (\"Hello\");\n end if;\nend Main;\n"
}
}
},
"wait": []
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"id": 7,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "$URI{main.adb}"
},
"position": {
"line": 3,
"character": 33
},
"context": {
"triggerKind": 1
}
}
},
"wait": [
{
"id": 7,
"result": {
"isIncomplete": false,
"items": []
}
}
]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"id": 8,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "$URI{main.adb}"
},
"position": {
"line": 3,
"character": 33
},
"context": {
"triggerKind": 1
}
}
},
"wait": [
{
"id": 8,
"result": {
"isIncomplete": false,
"items": []
}
}
]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"method": "textDocument/didClose",
"params": {
"textDocument": {
"uri": "$URI{src/main.adb"
}
}
},
"wait": []
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"id": 9,
"method": "shutdown"
},
"wait": [
{
"id": 9,
"result": null
}
]
}
},
{
"stop": {
"exit_code": 0
}
}
]
1 change: 1 addition & 0 deletions testsuite/ada_lsp/completion.aggregates.string/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: 'completion.aggregates.string'

0 comments on commit e9b14a0

Please sign in to comment.