Closed pauldemarco closed 1 day ago
The reason for what you observe is there are 2 separate mechanisms generating completions. One is used for remote functions and the other for local buffer completions. The remote one relies on compiled beams - it extracts info from EEP48 doc chunks and typespec chunks. The local one relies on AST analysis. Keyword argument completions are only implemented for remote typespec (as returned by Code.Typespec.fetch_specs internal elixir API). We would need something similar that extracts keyword lists from typespec AST in current buffer. Side note: typespecs are going to be deprecated in elixir and replaced with typesystem. There is a plan for typesystem to handle keyword lists but it most likely will not land soon
Thanks for the clarification. Looking forward to the typesystem!
Keyword list completions from the current buffer are already tracked in https://github.com/elixir-lsp/elixir-ls/issues/1070
Environment
Current behavior
There is no autocomplete for function arguments that are keywords. This applies to Modules that implement a behaviour function and have their own typespec.
Reproduction steps:
This is our goal -- notice how autocomplete works with GenServer's start_link options:
Let's try to recreate this awesomeness with our own Module:
@behaviour MyBehaviour
.