You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
([auto completion from my neovim config](https://github.com/glepnir/nvim/blob/main/lua/internal/completion.lua))
11
+
Words are stored in a [Trie](https://wikipedia.org/wiki/Trie), additionally, they are weighted in frequency and last time used. Low frequency words are cleaned up periodically to speed the process up even more.
13
12
14
-
In the Phoenix framework, a Trie tree is used to store words, ensuring that the
15
-
completion results can be obtained in O(L) time (L is the length of the word).
16
-
Additionally, the weight of each word is calculated based on its usage frequency
17
-
and last usage time, and low-frequency words are asynchronously cleaned up periodically
18
-
to ensure that the desired results can be obtained quickly with each input.
19
-
20
-
For path completion, Phoenix uses an LRU (Least Recently Used) cache to handle
21
-
the results, and the completion results can be obtained in O(1) time. Meanwhile,
22
-
the cache is cleaned up based on a set time period to ensure that the directory
23
-
status is kept synchronized.
13
+
Path completion is done in a similar fashion.
24
14
25
15
## Usage
26
16
27
17
**Require neovim nightly**
28
18
29
-
```lua
30
-
require('phoenix').setup()
31
-
```
19
+
You have to setup your completion to use the fake `phoenix` language server. ([Example using vim.lsp.completion](https://github.com/glepnir/nvim/blob/main/lua/internal/completion.lua)).
32
20
33
-
default config and custom in `vim.g.phoenix` option table.
21
+
Options are configured via `vim.g.phoenix`.
34
22
35
-
```
23
+
```lua
36
24
{
37
25
filetypes= { '*' },
38
-
-- Dictionary related settings
26
+
27
+
-- Internal cache settings
39
28
dict= {
40
29
-- Maximum number of words to store in the dictionary
41
30
-- Higher values consume more memory but provide better completions
@@ -44,6 +33,7 @@ default config and custom in `vim.g.phoenix` option table.
44
33
-- Minimum word length to be considered for completion
45
34
-- Shorter words may create noise in completions
46
35
min_word_length=2,
36
+
47
37
-- Time factor weight for sorting completions (0-1)
48
38
-- Higher values favor recently used items more strongly
49
39
recency_weight=0.3,
@@ -56,9 +46,11 @@ default config and custom in `vim.g.phoenix` option table.
56
46
-- Performance related settings
57
47
scan= {
58
48
cache_ttl=5000,
49
+
59
50
-- Number of items to process in each batch
60
51
-- Higher values improve speed but may cause stuttering
61
52
batch_size=1000,
53
+
62
54
-- Ignored the file or dictionary which matched the pattern
0 commit comments