@@ -258,7 +258,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
258
258
)
259
259
|> maybe_reject_derived_functions ( context , options )
260
260
|> Enum . map ( & from_completion_item ( & 1 , context , options ) )
261
- |> maybe_add_do ( context )
261
+ |> maybe_add_do ( context , options )
262
262
|> maybe_add_keywords ( context )
263
263
|> Enum . reject ( & is_nil / 1 )
264
264
|> sort_items ( )
@@ -296,7 +296,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
296
296
{ :ok , % { "isIncomplete" => is_incomplete ( items_json ) , "items" => items_json } }
297
297
end
298
298
299
- defp maybe_add_do ( completion_items , context ) do
299
+ defp maybe_add_do ( completion_items , context , options ) do
300
300
hint =
301
301
case Regex . scan ( ~r/ (?<=\s |^)[a-z]+$/ u , context . text_before_cursor ) do
302
302
[ ] -> ""
@@ -309,7 +309,15 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
309
309
kind: :keyword ,
310
310
detail: "reserved word" ,
311
311
insert_text:
312
- if ( String . trim ( context . text_after_cursor ) == "" , do: "do\n $0\n end" , else: "do: " ) ,
312
+ if String . trim ( context . text_after_cursor ) == "" do
313
+ if Keyword . get ( options , :snippets_supported , false ) do
314
+ "do\n $0\n end"
315
+ else
316
+ "do"
317
+ end
318
+ else
319
+ "do: "
320
+ end ,
313
321
tags: [ ] ,
314
322
priority: 0 ,
315
323
# force selection over other longer not exact completions
0 commit comments