File tree 3 files changed +12
-4
lines changed
crates/rust-analyzer/src/lsp
3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -823,8 +823,11 @@ impl Request for OnTypeFormatting {
823
823
#[ derive( Debug , Serialize , Deserialize ) ]
824
824
pub struct CompletionResolveData {
825
825
pub position : lsp_types:: TextDocumentPositionParams ,
826
+ #[ serde( skip_serializing_if = "Vec::is_empty" , default ) ]
826
827
pub imports : Vec < CompletionImport > ,
828
+ #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
827
829
pub version : Option < i32 > ,
830
+ #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
828
831
pub trigger_character : Option < char > ,
829
832
pub for_ref : bool ,
830
833
pub hash : String ,
@@ -836,6 +839,7 @@ pub struct InlayHintResolveData {
836
839
// This is a string instead of a u64 as javascript can't represent u64 fully
837
840
pub hash : String ,
838
841
pub resolve_range : lsp_types:: Range ,
842
+ #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
839
843
pub version : Option < i32 > ,
840
844
}
841
845
Original file line number Diff line number Diff line change 2
2
use std:: {
3
3
iter:: once,
4
4
mem,
5
+ ops:: Not as _,
5
6
sync:: atomic:: { AtomicU32 , Ordering } ,
6
7
} ;
7
8
@@ -358,9 +359,12 @@ fn completion_item(
358
359
filter_text,
359
360
kind : Some ( completion_item_kind ( item. kind ) ) ,
360
361
text_edit,
361
- additional_text_edits : Some ( additional_text_edits) ,
362
+ additional_text_edits : additional_text_edits
363
+ . is_empty ( )
364
+ . not ( )
365
+ . then_some ( additional_text_edits) ,
362
366
documentation,
363
- deprecated : Some ( item. deprecated ) ,
367
+ deprecated : item . deprecated . then_some ( item. deprecated ) ,
364
368
tags,
365
369
command,
366
370
insert_text_format,
@@ -370,7 +374,7 @@ fn completion_item(
370
374
if config. completion_label_details_support ( ) {
371
375
if fields_to_resolve. resolve_label_details {
372
376
something_to_resolve |= true ;
373
- } else {
377
+ } else if item . label_detail . is_some ( ) || item . detail . is_some ( ) {
374
378
lsp_item. label_details = Some ( lsp_types:: CompletionItemLabelDetails {
375
379
detail : item. label_detail . as_ref ( ) . map ( ToString :: to_string) ,
376
380
description : item. detail . clone ( ) ,
Original file line number Diff line number Diff line change 1
1
<!-- -
2
- lsp/ext.rs hash: 14b7fb1309f5bb00
2
+ lsp/ext.rs hash: 9790509d87670c22
3
3
4
4
If you need to change the above hash to make the test pass, please check if you
5
5
need to adjust this doc as well and ping this issue:
You can’t perform that action at this time.
0 commit comments