Skip to content

Commit f7bddaf

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents 8706286 + 4b5ec95 commit f7bddaf

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

doc/settings.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ The value is a boolean.
103103
'renameInComments': false
104104
```
105105

106+
## useCompletionSnippets
107+
Whether we should use snippets in completion results. Snippets can be
108+
returned in case of subprogram calls for instance, with placeholders
109+
for each parameter needed by the subprogram.
110+
The value is a boolean.
111+
112+
```javascript
113+
'useCompletionSnippets': true
114+
```
115+
106116
## displayMethodAncestryOnNavigation
107117
This setting controls the policy for displaying overriding and overridden
108118
subprograms on navigation requests such as `textDocument/definition`,

integration/vscode/ada/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@
333333
"default": true,
334334
"description": "The emission of diagnostics."
335335
},
336+
"ada.useCompletionSnippets": {
337+
"scope": "resource",
338+
"type": "boolean",
339+
"default": false,
340+
"description": "Enable snippets in completion results (e.g: subprogram calls)."
341+
},
336342
"ada.renameInComments": {
337343
"scope": "resource",
338344
"type": "boolean",
@@ -455,4 +461,4 @@
455461
"vscode-languageclient": "7.0.0",
456462
"ws": "8.5.0"
457463
}
458-
}
464+
}

source/ada/lsp-ada_handlers.adb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4059,6 +4059,8 @@ package body LSP.Ada_Handlers is
40594059
"followSymlinks";
40604060
documentationStyle : constant String :=
40614061
"documentationStyle";
4062+
useCompletionSnippets : constant String :=
4063+
"useCompletionSnippets";
40624064

40634065
Ada : constant LSP.Types.LSP_Any := Value.settings.Get ("ada");
40644066
File : VSS.Strings.Virtual_String;
@@ -4137,6 +4139,14 @@ package body LSP.Ada_Handlers is
41374139
Self.Named_Notation_Threshold := Ada.Get (namedNotationThreshold);
41384140
end if;
41394141

4142+
-- Check the 'useCompletionSnippets' flag to see if we should use
4143+
-- snippets in completion (if the client supports it).
4144+
if not Self.Completion_Snippets_Enabled then
4145+
Self.Use_Completion_Snippets := False;
4146+
elsif Ada.Has_Field (useCompletionSnippets) then
4147+
Self.Use_Completion_Snippets := Ada.Get (useCompletionSnippets);
4148+
end if;
4149+
41404150
-- Retrieve the policy for displaying type hierarchy on navigation
41414151
-- requests.
41424152
if Ada.Has_Field (displayMethodAncestryOnNavigation) then
@@ -5259,7 +5269,7 @@ package body LSP.Ada_Handlers is
52595269
LSP.Ada_Completions.Attributes.Attributes_Completion_Provider;
52605270

52615271
P6 : aliased LSP.Ada_Completions.Names.Name_Completion_Provider
5262-
(Self.Completion_Snippets_Enabled);
5272+
(Self.Use_Completion_Snippets);
52635273
P7 : aliased LSP.Ada_Handlers.Invisibles.Invisible_Completion_Provider
52645274
(Self, Context);
52655275
P8 : aliased

source/ada/lsp-ada_handlers.ads

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ private
268268
Completion_Snippets_Enabled : Boolean := False;
269269
-- True if the client supports completion snippets
270270

271+
Use_Completion_Snippets : Boolean := True;
272+
-- True if we should use snippets for completion (e.g:
273+
-- subprogram calls).
274+
271275
Completion_Resolve_Properties : VSS.String_Vectors.Virtual_String_Vector;
272276
-- The list of CompletionItem properties that can be resolved
273277
-- lazily (i.e: when the item is selected on client-side) via

0 commit comments

Comments
 (0)