Skip to content

Commit

Permalink
Merge branch 'topic/fix_snippets' into 'master'
Browse files Browse the repository at this point in the history
Don't send snippets in completion

See merge request eng/ide/ada_language_server!1395
  • Loading branch information
reznikmm committed Oct 3, 2023
2 parents bea5f92 + 52bec17 commit 8d7644f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
18 changes: 18 additions & 0 deletions source/ada/lsp-ada_client_capabilities.adb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ package body LSP.Ada_Client_Capabilities is
else False);
end Code_ActionLiteralSupport;

-------------------------------
-- Completion_SnippetSupport --
-------------------------------

function Completion_SnippetSupport
(Self : Client_Capability'Class) return Boolean
is
use LSP.Structures.Unwrap;

Result : constant LSP.Structures.Boolean_Optional :=
snippetSupport
(completionItem
(completion
(Self.Value.capabilities.textDocument)));
begin
return (if Result.Is_Set then Result.Value else False);
end Completion_SnippetSupport;

-----------------------------------------------
-- didChangeWatchedFiles_dynamicRegistration --
-----------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions source/ada/lsp-ada_client_capabilities.ads
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ package LSP.Ada_Client_Capabilities is
(Self : Client_Capability'Class) return Boolean;
-- Returns textDocument.documentSymbol.hierarchicalDocumentSymbolSupport

function Completion_SnippetSupport
(Self : Client_Capability'Class) return Boolean;
-- Returns textDocument.completion.completionItem.snippetSupport

function didChangeWatchedFiles_dynamicRegistration
(Self : Client_Capability'Class) return Boolean;
-- Returns capabilities.workspace.didChangeWatchedFiles.dynamicRegistration
Expand Down
4 changes: 3 additions & 1 deletion source/ada/lsp-ada_handlers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,9 @@ package body LSP.Ada_Handlers is
LSP.Ada_Completions.Attributes.Attributes_Completion_Provider;

P5 : aliased LSP.Ada_Completions.Names.Name_Completion_Provider
(Self.Configuration.Use_Completion_Snippets);
(Self.Configuration.Use_Completion_Snippets
and then Self.Client.Completion_SnippetSupport);

P6 : aliased LSP.Ada_Handlers.Invisibles.Invisible_Completion_Provider
(Self'Access, Context);
P7 : aliased
Expand Down
5 changes: 5 additions & 0 deletions source/lsp_3.17/lsp-structures-unwrap.ads
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ package LSP.Structures.Unwrap is
return resolveSupport_OfWorkspaceSymbolClientCapabilities_Optional is
(if X.Is_Set then X.Value.resolveSupport else (Is_Set => False));

function snippetSupport
(X : completionItem_OfCompletionClientCapabilities_Optional)
return Boolean_Optional is
(if X.Is_Set then X.Value.snippetSupport else (Is_Set => False));

function properties
(X : resolveSupport_OfWorkspaceSymbolClientCapabilities_Optional)
return LSP.Structures.Virtual_String_Vector is
Expand Down

0 comments on commit 8d7644f

Please sign in to comment.