Skip to content

Commit 002b72e

Browse files
committed
fix: removed preselect option
1 parent ef4e999 commit 002b72e

File tree

5 files changed

+1
-10
lines changed

5 files changed

+1
-10
lines changed

book/src/configuration.md

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ hidden = false
5454
| Key | Description | Default |
5555
| --- | ----------- | ------- |
5656
| `display-messages` | Display LSP progress messages below statusline[^1] | `false` |
57-
| `preselect` | Show the LSP server's preselected suggestions first | `true` |
5857

5958
[^1]: A progress spinner is always shown in the statusline beside the file path.
6059

helix-term/src/commands/lsp.rs

-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ pub fn code_action(cx: &mut Context) {
453453
actions,
454454
(),
455455
ui::menu::SortStrategy::Text,
456-
false,
457456
move |editor, code_action, event| {
458457
if event != PromptEvent::Validate {
459458
return;

helix-term/src/ui/completion.rs

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl Completion {
100100
items,
101101
(),
102102
menu::SortStrategy::Score,
103-
editor.config().lsp.preselect.unwrap_or(false),
104103
move |editor: &mut Editor, item, event| {
105104
fn item_to_transaction(
106105
doc: &Document,

helix-term/src/ui/menu.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ pub struct Menu<T: Item> {
7676
viewport: (u16, u16),
7777
recalculate: bool,
7878
sort_strategy: SortStrategy,
79-
use_preselect: bool,
8079
}
8180

8281
impl<T: Item> Menu<T> {
@@ -88,7 +87,6 @@ impl<T: Item> Menu<T> {
8887
options: Vec<T>,
8988
editor_data: <T as Item>::Data,
9089
sort_strategy: SortStrategy,
91-
use_preselect: bool,
9290
callback_fn: impl Fn(&mut Editor, Option<&T>, MenuEvent) + 'static,
9391
) -> Self {
9492
let mut menu = Self {
@@ -104,7 +102,6 @@ impl<T: Item> Menu<T> {
104102
viewport: (0, 0),
105103
recalculate: true,
106104
sort_strategy,
107-
use_preselect,
108105
};
109106

110107
// TODO: scoring on empty input should just use a fastpath
@@ -116,7 +113,6 @@ impl<T: Item> Menu<T> {
116113
pub fn score(&mut self, pattern: &str) {
117114
// dereference pointers here, not inside of the filter_map() loop
118115
let is_pattern_empty = pattern.is_empty();
119-
let use_preselect = self.use_preselect;
120116

121117
// reuse the matches allocation
122118
self.matches.clear();
@@ -129,7 +125,7 @@ impl<T: Item> Menu<T> {
129125
// TODO: using fuzzy_indices could give us the char idx for match highlighting
130126

131127
// If prompt pattern is empty, show the preselected item as first option
132-
if use_preselect && is_pattern_empty {
128+
if is_pattern_empty {
133129
if option.preselected() {
134130
// The LSP server can preselect multiple items, however it doesn't give any preference
135131
// for one over the other, so they all have the same score

helix-view/src/editor.rs

-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ pub struct Config {
172172
pub struct LspConfig {
173173
/// Whether to display LSP status messages below the statusline
174174
pub display_messages: bool,
175-
/// Whether to use show the LSP server preselected suggestion at the top of the menu. Defaults to true.
176-
pub preselect: Option<bool>,
177175
}
178176

179177
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]

0 commit comments

Comments
 (0)