Skip to content

Commit d645463

Browse files
committed
add readme section about completions
1 parent fa69c6c commit d645463

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,27 @@ You can control which warnings are shown using the `elixirLS.dialyzerWarnOpts` s
8787

8888
ElixirLS's Dialyzer integration uses internal, undocumented Dialyzer APIs, and so it won't be robust against changes to these APIs in future Erlang versions.
8989

90+
## Code completion
91+
92+
ElixirLS bundles an advanced code completion provider. The provider builds on [Elixir Sense](https://github.com/elixir-lsp/elixir_sense) library and utilizes two main mechanisms. The first one is reflection - getting information about compiled modules by Erlang and Elixir APIs. The second one is AST analysis of the current text buffer. While reflection gives precise results, it is not well suited for on demand completion of symbols from the currently edited file. The compiled version is likely to be outdated or the file may not compile at all. AST analysis helps in that case but it has its limitations. Unfortunately it is infeasible to be 100% accurate, especially with Elixir being a metaprogramming heavy language.
93+
94+
The completions include:
95+
96+
- keywords
97+
- special form snippets
98+
- functions
99+
- macros
100+
- modules
101+
- variables
102+
- struct fields (if the struct type is explicitely stated or can be infered from variable binding)
103+
- atom map keys (if map keys can be infered from variable binding)
104+
- attrubutes
105+
- types (in typespecs)
106+
- behaviour callbacks (inside the body of implementing module)
107+
- protocol functions (inside the body of implementing module)
108+
- keys in keyword functions arguments (if defined in spec)
109+
- function returns (if defined in spec)
110+
90111
## Workspace Symbols
91112

92113
With Dialyzer integration enabled ElixirLS will build an index of symbols (modules, functions, types and callbacks). The symbols are taken from the current workspace, all dependencies and stdlib (Elixir and erlang). This feature enables quick navigation to symbol definitions. However due to sheer number of different symbols and fuzzy search utilized by the provider, ElixirLS uses query prefixes to improve search results relevance.

0 commit comments

Comments
 (0)