@@ -272,8 +272,8 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
272
272
defp from_completion_item (
273
273
% {
274
274
type: :callback ,
275
+ subtype: subtype ,
275
276
args: args ,
276
- spec: spec ,
277
277
name: name ,
278
278
summary: summary ,
279
279
arity: arity ,
@@ -283,13 +283,13 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
283
283
context ,
284
284
options
285
285
) do
286
- if ( context [ :def_before ] == :def && String . starts_with? ( spec , "@ macrocallback" ) ) ||
287
- ( context [ :def_before ] == :defmacro && String . starts_with? ( spec , "@ callback" ) ) do
286
+ if ( context [ :def_before ] == :def && subtype == : macrocallback) ||
287
+ ( context [ :def_before ] == :defmacro && subtype == : callback) do
288
288
nil
289
289
else
290
290
def_str =
291
291
if context [ :def_before ] == nil do
292
- if String . starts_with? ( spec , "@ macrocallback" ) do
292
+ if subtype == : macrocallback do
293
293
"defmacro "
294
294
else
295
295
"def "
@@ -310,7 +310,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
310
310
% __MODULE__ {
311
311
label: label ,
312
312
kind: :interface ,
313
- detail: "#{ origin } callback " ,
313
+ detail: "#{ origin } #{ subtype } " ,
314
314
documentation: summary ,
315
315
insert_text: insert_text ,
316
316
priority: 12 ,
@@ -334,21 +334,24 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
334
334
context ,
335
335
options
336
336
) do
337
- def_str = if ( context [ :def_before ] == nil , do: "def " )
337
+ unless context [ :def_before ] == :defmacro do
338
+ def_str = if ( context [ :def_before ] == nil , do: "def " )
338
339
339
- insert_text = def_snippet ( def_str , name , args , arity , options )
340
- label = "#{ def_str } #{ name } /#{ arity } "
340
+ opts = Keyword . put ( options , :with_parens? , true )
341
+ insert_text = def_snippet ( def_str , name , args , arity , opts )
342
+ label = "#{ def_str } #{ name } /#{ arity } "
341
343
342
- % __MODULE__ {
343
- label: label ,
344
- kind: :interface ,
345
- detail: "#{ origin } protocol function" ,
346
- documentation: summary ,
347
- insert_text: insert_text ,
348
- priority: 12 ,
349
- filter_text: name ,
350
- tags: metadata_to_tags ( metadata )
351
- }
344
+ % __MODULE__ {
345
+ label: label ,
346
+ kind: :interface ,
347
+ detail: "#{ origin } protocol function" ,
348
+ documentation: summary ,
349
+ insert_text: insert_text ,
350
+ priority: 12 ,
351
+ filter_text: name ,
352
+ tags: metadata_to_tags ( metadata )
353
+ }
354
+ end
352
355
end
353
356
354
357
defp from_completion_item (
0 commit comments