@@ -47,7 +47,7 @@ use self::lsp::ext as lsp_ext;
47
47
#[ cfg( test) ]
48
48
mod integrated_benchmarks;
49
49
50
- use ide:: { CompletionItem , CompletionRelevance , TextEdit , TextRange } ;
50
+ use ide:: { CompletionItem , CompletionRelevance } ;
51
51
use serde:: de:: DeserializeOwned ;
52
52
use tenthash:: TentHasher ;
53
53
@@ -65,18 +65,6 @@ pub fn from_json<T: DeserializeOwned>(
65
65
}
66
66
67
67
fn completion_item_hash ( item : & CompletionItem , is_ref_completion : bool ) -> [ u8 ; 20 ] {
68
- fn hash_text_range ( hasher : & mut TentHasher , text_range : & TextRange ) {
69
- hasher. update ( u32:: from ( text_range. start ( ) ) . to_le_bytes ( ) ) ;
70
- hasher. update ( u32:: from ( text_range. end ( ) ) . to_le_bytes ( ) ) ;
71
- }
72
-
73
- fn hash_text_edit ( hasher : & mut TentHasher , edit : & TextEdit ) {
74
- for indel in edit. iter ( ) {
75
- hasher. update ( & indel. insert ) ;
76
- hash_text_range ( hasher, & indel. delete ) ;
77
- }
78
- }
79
-
80
68
fn hash_completion_relevance ( hasher : & mut TentHasher , relevance : & CompletionRelevance ) {
81
69
use ide_completion:: {
82
70
CompletionRelevancePostfixMatch , CompletionRelevanceReturnType ,
@@ -130,8 +118,8 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8;
130
118
if let Some ( label_detail) = & item. label_detail {
131
119
hasher. update ( label_detail) ;
132
120
}
133
- hash_text_range ( & mut hasher , & item . source_range ) ;
134
- hash_text_edit ( & mut hasher , & item . text_edit ) ;
121
+ // NB: do not hash edits or source range, as those may change between the time the client sends the resolve request
122
+ // and the time it receives it: some editors do allow changing the buffer between that, leading to ranges being different.
135
123
hasher. update ( item. kind . tag ( ) ) ;
136
124
hasher. update ( & item. lookup ) ;
137
125
if let Some ( detail) = & item. detail {
0 commit comments