@@ -82,16 +82,6 @@ impl Completion {
8282 // and we insert at position.
8383 };
8484
85− // TODO: merge edit with additional_text_edits
86− if let Some(additional_edits) = &item.additional_text_edits {
87− if !additional_edits.is_empty() {
88− unimplemented!(
89− "completion: additional_text_edits: {:?}",
90− additional_edits
91− );
92− }
93− }
94−
9585 // if more text was entered, remove it
9686 let cursor = doc.selection(view.id).cursor();
9787 if trigger_offset < cursor {
@@ -109,6 +99,19 @@ impl Completion {
10999 offset_encoding, // TODO: should probably transcode in Client
110100 );
111101 doc.apply(&transaction, view.id);
102+
103+ // TODO: merge edit with additional_text_edits
104+ if let Some(additional_edits) = &item.additional_text_edits {
105+ // gopls uses this to add extra imports
106+ if !additional_edits.is_empty() {
107+ let transaction = util::generate_transaction_from_edits(
108+ doc.text(),
109+ additional_edits.clone(),
110+ offset_encoding, // TODO: should probably transcode in Client
111+ );
112+ doc.apply(&transaction, view.id);
113+ }
114+ }
112115 }
113116 _ => (),
114117 };