@@ -9,12 +9,42 @@ instant completion in projects with thousands of files.
99
1010![ Image] ( https://github.com/user-attachments/assets/ec81041b-7f37-4613-ad91-419a76ee2eeb )
1111
12+ In the Phoenix framework, a Trie tree is used to store words, ensuring that the
13+ completion results can be obtained in O(L) time (L is the length of the word).
14+ Additionally, the weight of each word is calculated based on its usage frequency
15+ and last usage time, and low-frequency words are asynchronously cleaned up periodically
16+ to ensure that the desired results can be obtained quickly with each input.
17+
18+ For path completion, Phoenix uses an LRU (Least Recently Used) cache to handle
19+ the results, and the completion results can be obtained in O(1) time. Meanwhile,
20+ the cache is cleaned up based on a set time period to ensure that the directory
21+ status is kept synchronized.
22+
23+ Specifically:
24+
25+ 1 . Word Completion:
26+ - Use a Trie tree to store words, with each node representing a character.
27+ - Each word node stores the usage frequency and last usage time of the word.
28+ - During completion, search the Trie tree for matching words based on the input
29+ prefix, and return the results sorted by weight.
30+ - Periodically clean up low-frequency words asynchronously to keep the Trie tree
31+ size within a reasonable range.
32+
33+ 2 . Path Completion:
34+ - Use an LRU cache to store directory structure information, including files
35+ and subdirectories in the directory.
36+ - During completion, directly look up the matching path in the cache, and obtain
37+ the result in O(1) time.
38+ - Periodically sync the cache to ensure that the directory status is kept
39+ synchronized.
40+
41+
1242## Usage
1343
1444``` lua
1545require (' phoenix' ).setup ()
1646```
1747
18- all config in ` vim.g.phoenix ` option table
48+ all config in ` vim.g.phoenix ` option table see source file ...
1949
2050## License MIT
0 commit comments