lexical-lsp / lexical

Lexical is a next-generation elixir language server
888 stars 82 forks source link

Infer default function signature when completing `def`/`defp` on the line after a `@spec` #787

Closed zachallaun closed 3 months ago

zachallaun commented 4 months ago

The following:

@spec my_function(String.t()) :: term()
def|

Completes to:

@spec my_function(String.t()) :: term()
def name() do

end

If the completion is proceeded by a @spec, the function name and arity could be inferred:

@spec my_function(String.t()) :: term()
def my_function(arg1) do

end