Skip to content

Commit 6c032ef

Browse files
rossmeierSchottkyc137
authored andcommitted
fix crash when autocompleting port map
4f20cbd introduced a regression that causes `completion_item_to_lsp_item` to fail for a formal as insert_text is no longer set now. The new implementation for the conversion function is robust and uses insert_text when available and falls back to the item's label (as an LSP client would)
1 parent 6953027 commit 6c032ef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vhdl_ls/src/vhdl_server/completion.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ impl VHDLServer {
2828
let mut item = self.entity_to_completion_item(ent);
2929
if self.client_supports_snippets() {
3030
item.insert_text_format = Some(InsertTextFormat::SNIPPET);
31-
item.insert_text = Some(format!("{} => $1,", item.insert_text.unwrap()));
31+
item.insert_text = Some(format!(
32+
"{} => $1,",
33+
item.insert_text.as_ref().unwrap_or(&item.label)
34+
));
3235
}
3336
item
3437
}

0 commit comments

Comments
 (0)