@@ -166,7 +166,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
166
166
167
167
# add trigger signatures to arity 0 if there are higher arity completions that would trigger
168
168
commands = items
169
- |> Enum . filter ( & & 1 . kind in [ :function ] )
169
+ |> Enum . filter ( & & 1 . kind in [ :function , :class ] )
170
170
|> Enum . group_by ( & { & 1 . kind , & 1 . label } )
171
171
|> Map . new ( fn { key , values } ->
172
172
command = Enum . find_value ( values , & & 1 . command )
@@ -175,8 +175,8 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
175
175
176
176
items = items
177
177
|> Enum . map ( fn
178
- % { command: nil } = item ->
179
- command = commands [ { item . kind , item . label } ]
178
+ % { command: nil , kind: kind } = item when kind in [ :function , :class ] ->
179
+ command = commands [ { kind , item . label } ]
180
180
if command do
181
181
% { item |
182
182
command: command ,
@@ -630,7 +630,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
630
630
defp from_completion_item (
631
631
% { type: :type_spec , metadata: metadata } = suggestion ,
632
632
_context ,
633
- _options
633
+ options
634
634
) do
635
635
% {
636
636
name: name ,
@@ -656,6 +656,19 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
656
656
"#{ name } ()"
657
657
end
658
658
659
+ signature_help_supported? = Keyword . get ( options , :signature_help_supported , false )
660
+ signature_after_complete? = Keyword . get ( options , :signature_after_complete , true )
661
+
662
+ trigger_signature? = signature_help_supported? && arity > 1
663
+
664
+ command =
665
+ if trigger_signature? && signature_after_complete? do
666
+ % {
667
+ "title" => "Trigger Parameter Hint" ,
668
+ "command" => "editor.action.triggerParameterHints"
669
+ }
670
+ end
671
+
659
672
% __MODULE__ {
660
673
label: name ,
661
674
detail: "typespec #{ signature } " ,
@@ -667,7 +680,8 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
667
680
insert_text: snippet ,
668
681
priority: 10 ,
669
682
kind: :class ,
670
- tags: metadata_to_tags ( metadata )
683
+ tags: metadata_to_tags ( metadata ) ,
684
+ command: command
671
685
}
672
686
end
673
687
0 commit comments