editor: Use fuzzy crate in code completions tests instead of hard coded values (#32565)
This PR makes it a lot cleaner to write code completion tests. It doesn't contain any logical changes, just refactoring. Before, we used to depend on hard-coded values of fuzzy score and its positions for tests. Now we don't need them, as fuzzy crate will handle that for us. This is possible because fuzzy match score isn't dependent on relative candidates or the number of candidates; rather, it's just a one-to-one mapping for each candidate and its score. This also makes it test robust for future purposes if there are changes in fuzzy score logic. Before: ```rs SortableMatch { string_match: StringMatch { // -> whole struct provided by fuzzy crate candidate_id: 1115, score: 1.0, positions: vec![], string: "Item".to_string(), }, is_snippet: false, // -> changed to snippet kind sort_text: Some("16"), sort_kind: 3, // -> changed to function, constant, variable kind sort_label: "Item", }, ``` After: ```rs CompletionBuilder::function("Item", "16") ``` Release Notes: - N/A
This commit is contained in:
parent
7f150f7e0f
commit
65a1d09d24
2 changed files with 394 additions and 2340 deletions
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue