@@ -47,7 +47,7 @@ use self::lsp::ext as lsp_ext;
4747#[ cfg( test) ]
4848mod integrated_benchmarks;
4949
50- use ide:: { CompletionItem , CompletionRelevance , TextEdit , TextRange } ;
50+ use ide:: { CompletionItem , CompletionRelevance } ;
5151use serde:: de:: DeserializeOwned ;
5252use tenthash:: TentHasher ;
5353
@@ -65,18 +65,6 @@ pub fn from_json<T: DeserializeOwned>(
6565}
6666
6767fn 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-
8068 fn hash_completion_relevance ( hasher : & mut TentHasher , relevance : & CompletionRelevance ) {
8169 use ide_completion:: {
8270 CompletionRelevancePostfixMatch , CompletionRelevanceReturnType ,
@@ -130,8 +118,8 @@ fn completion_item_hash(item: &CompletionItem, is_ref_completion: bool) -> [u8;
130118 if let Some ( label_detail) = & item. label_detail {
131119 hasher. update ( label_detail) ;
132120 }
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.
135123 hasher. update ( item. kind . tag ( ) ) ;
136124 hasher. update ( & item. lookup ) ;
137125 if let Some ( detail) = & item. detail {
0 commit comments