File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
crates/rust-analyzer/src/lsp Expand file tree Collapse file tree 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 {
823823#[ derive( Debug , Serialize , Deserialize ) ]
824824pub struct CompletionResolveData {
825825 pub position : lsp_types:: TextDocumentPositionParams ,
826+ #[ serde( skip_serializing_if = "Vec::is_empty" , default ) ]
826827 pub imports : Vec < CompletionImport > ,
828+ #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
827829 pub version : Option < i32 > ,
830+ #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
828831 pub trigger_character : Option < char > ,
829832 pub for_ref : bool ,
830833 pub hash : String ,
@@ -836,6 +839,7 @@ pub struct InlayHintResolveData {
836839 // This is a string instead of a u64 as javascript can't represent u64 fully
837840 pub hash : String ,
838841 pub resolve_range : lsp_types:: Range ,
842+ #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
839843 pub version : Option < i32 > ,
840844}
841845
Original file line number Diff line number Diff line change 22use std:: {
33 iter:: once,
44 mem,
5+ ops:: Not as _,
56 sync:: atomic:: { AtomicU32 , Ordering } ,
67} ;
78
@@ -358,9 +359,12 @@ fn completion_item(
358359 filter_text,
359360 kind : Some ( completion_item_kind ( item. kind ) ) ,
360361 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) ,
362366 documentation,
363- deprecated : Some ( item. deprecated ) ,
367+ deprecated : item . deprecated . then_some ( item. deprecated ) ,
364368 tags,
365369 command,
366370 insert_text_format,
@@ -370,7 +374,7 @@ fn completion_item(
370374 if config. completion_label_details_support ( ) {
371375 if fields_to_resolve. resolve_label_details {
372376 something_to_resolve |= true ;
373- } else {
377+ } else if item . label_detail . is_some ( ) || item . detail . is_some ( ) {
374378 lsp_item. label_details = Some ( lsp_types:: CompletionItemLabelDetails {
375379 detail : item. label_detail . as_ref ( ) . map ( ToString :: to_string) ,
376380 description : item. detail . clone ( ) ,
Original file line number Diff line number Diff line change 11<!-- -
2- lsp/ext.rs hash: 14b7fb1309f5bb00
2+ lsp/ext.rs hash: 9790509d87670c22
33
44If you need to change the above hash to make the test pass, please check if you
55need to adjust this doc as well and ping this issue:
You can’t perform that action at this time.
0 commit comments