-
Notifications
You must be signed in to change notification settings - Fork 26
Use fst for symbol search #141
Use fst for symbol search #141
Conversation
* support for subsequence match (useful for fuzzy-search in IDEs) * support for pagination: you can limit the number of results and resume searching from the last result
|
BTW, VS Code docs explicitly advice against using prefix-match :)
https://code.visualstudio.com/docs/extensionAPI/vscode-api#WorkspaceSymbolProvider |
nrc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks like a good move.
src/analysis.rs
Outdated
| pub children: HashMap<Id, HashSet<Id>>, | ||
| pub def_names: HashMap<String, Vec<Id>>, | ||
| pub def_trie: Trie<String, Vec<Id>>, | ||
| // pub def_trie: Trie<String, Vec<Id>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove this rather than comment it out please?
src/fstq.rs
Outdated
| @@ -0,0 +1,82 @@ | |||
| use fst; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comments explaining what this module is for?
src/analysis.rs
Outdated
| } | ||
|
|
||
| pub enum MatchingDefsQueryKind { | ||
| Preifx(String), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Prefix
src/analysis.rs
Outdated
| }) | ||
| } | ||
|
|
||
| pub fn matching_defs_q(&self, query: MatchingDefsQuery) -> Vec<Def> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/_q/_query please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or _with_query
|
Cleaned-up the implementation, should be ready for the review now |
9c81276 to
b4d15bb
Compare
|
Might be a good idea to cut a release after this PR. |
Given that we are allocating in the `.to_lowercase` anyway, there's no need to accept an `Into`.
|
Thanks! |
|
Publishd 0.14.0 |
WIP to get the feedback on the general idea.
This switches from prefix_trie to fst by @BurntSushi, which allows for much more powerful API:
search symbols either by prefix or by subsequence. This should fix the problem that
ctrl+T > vfsin VS Code does not findrange_from_vfs_file.limit the number of results returned. This should fix the problem of VS Code freezing after pressing
ctrl+Tand not typing a query string (which currently retrieves all of the symbols)support for streaming API. Now it is possible to get a huge list of symbols in small chunks, so that symbol search in the editor can give results instantly, and then load more results as user scrolls the list. Note that LSP/VS Code API in this area is suboptimal: symbol search returns a
Future<Vec<Symbol>>and not aStream<Symbol>. Hopefully that will be fixed one day.