File tree 3 files changed +16
-4
lines changed
3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -121,8 +121,14 @@ pub fn fuzzy(
121
121
}
122
122
"label" => {
123
123
matches. sort_by ( |a, b| {
124
- let label_a = & haystack[ a. index_in_haystack ] . label ;
125
- let label_b = & haystack[ b. index_in_haystack ] . label ;
124
+ let label_a = haystack[ a. index_in_haystack ]
125
+ . sort_text
126
+ . as_ref ( )
127
+ . unwrap_or ( & haystack[ a. index_in_haystack ] . label ) ;
128
+ let label_b = haystack[ b. index_in_haystack ]
129
+ . sort_text
130
+ . as_ref ( )
131
+ . unwrap_or ( & haystack[ b. index_in_haystack ] . label ) ;
126
132
127
133
// Put anything with an underscore at the end
128
134
match ( label_a. starts_with ( '_' ) , label_b. starts_with ( '_' ) ) {
Original file line number Diff line number Diff line change 65
65
function fuzzy .get_query ()
66
66
local line = vim .api .nvim_get_current_line ()
67
67
local keyword = config .completion .keyword
68
- local range =
69
- require (' blink.cmp.lib.utils' ).get_regex_around_cursor (keyword .range , keyword .regex , keyword .exclude_from_prefix_regex )
68
+ local range = require (' blink.cmp.lib.utils' ).get_regex_around_cursor (
69
+ keyword .range ,
70
+ keyword .regex ,
71
+ keyword .exclude_from_prefix_regex
72
+ )
70
73
return string.sub (line , range .start_col , range .start_col + range .length - 1 )
71
74
end
72
75
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use mlua::prelude::*;
4
4
pub struct LspItem {
5
5
pub label : String ,
6
6
pub filter_text : Option < String > ,
7
+ pub sort_text : Option < String > ,
7
8
pub kind : u32 ,
8
9
pub score_offset : i32 ,
9
10
pub source_id : String ,
@@ -14,13 +15,15 @@ impl FromLua for LspItem {
14
15
if let Some ( tab) = value. as_table ( ) {
15
16
let label = tab. get ( "label" ) . unwrap_or_default ( ) ;
16
17
let filter_text = tab. get ( "filterText" ) . ok ( ) ;
18
+ let sort_text = tab. get ( "sortText" ) . ok ( ) ;
17
19
let kind = tab. get ( "kind" ) . unwrap_or_default ( ) ;
18
20
let score_offset = tab. get ( "score_offset" ) . unwrap_or ( 0 ) ;
19
21
let source_id = tab. get ( "source_id" ) . unwrap_or_default ( ) ;
20
22
21
23
Ok ( LspItem {
22
24
label,
23
25
filter_text,
26
+ sort_text,
24
27
kind,
25
28
score_offset,
26
29
source_id,
You can’t perform that action at this time.
0 commit comments