Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions crates/rust-analyzer/src/to_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,27 @@ pub(crate) fn completion_item(
additional_text_edits: Some(additional_text_edits),
documentation: completion_item.documentation().map(documentation),
deprecated: Some(completion_item.deprecated()),
command: if completion_item.trigger_call_info() {
let cmd = lsp_types::Command {
title: "triggerParameterHints".into(),
command: "editor.action.triggerParameterHints".into(),
arguments: None,
};
Some(cmd)
} else {
None
},
..Default::default()
};

if completion_item.score().is_some() {
res.preselect = Some(true)
res.preselect = Some(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only one item can be preselected in the reply. I'm not sure we enforce that yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many items can, but that doesn't matter, as only the first one will be selected.

// HACK: sort preselect items first
res.sort_text = Some(format!(" {}", completion_item.label()));
}

if completion_item.deprecated() {
res.tags = Some(vec![lsp_types::CompletionItemTag::Deprecated])
}

if completion_item.trigger_call_info() {
res.command = Some(lsp_types::Command {
title: "triggerParameterHints".into(),
command: "editor.action.triggerParameterHints".into(),
arguments: None,
});
}

res.insert_text_format = Some(insert_text_format(completion_item.insert_text_format()));

res
Expand Down