Skip to content

Commit 5423faf

Browse files
Use proper inlay hint range when filtering out hints (#41363)
Follow-up of #40183 Release Notes: - N/A --------- Co-authored-by: Lukas Wirth <[email protected]>
1 parent 8a01e48 commit 5423faf

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

crates/editor/src/inlays/inlay_hints.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl Editor {
344344
.extend(invalidate_hints_for_buffers);
345345

346346
let mut buffers_to_query = HashMap::default();
347-
for (excerpt_id, (buffer, buffer_version, visible_range)) in visible_excerpts {
347+
for (_, (buffer, buffer_version, visible_range)) in visible_excerpts {
348348
let buffer_id = buffer.read(cx).remote_id();
349349
if !self.registered_buffers.contains_key(&buffer_id) {
350350
continue;
@@ -358,13 +358,11 @@ impl Editor {
358358
buffers_to_query
359359
.entry(buffer_id)
360360
.or_insert_with(|| VisibleExcerpts {
361-
excerpts: Vec::new(),
362361
ranges: Vec::new(),
363362
buffer_version: buffer_version.clone(),
364363
buffer: buffer.clone(),
365364
});
366365
visible_excerpts.buffer_version = buffer_version;
367-
visible_excerpts.excerpts.push(excerpt_id);
368366
visible_excerpts.ranges.push(buffer_anchor_range);
369367
}
370368

@@ -850,7 +848,6 @@ impl Editor {
850848

851849
#[derive(Debug)]
852850
struct VisibleExcerpts {
853-
excerpts: Vec<ExcerptId>,
854851
ranges: Vec<Range<text::Anchor>>,
855852
buffer_version: Global,
856853
buffer: Entity<language::Buffer>,
@@ -2017,7 +2014,7 @@ pub mod tests {
20172014
task_lsp_request_ranges.lock().push(params.range);
20182015
task_lsp_request_count.fetch_add(1, Ordering::Release);
20192016
Ok(Some(vec![lsp::InlayHint {
2020-
position: params.range.end,
2017+
position: params.range.start,
20212018
label: lsp::InlayHintLabel::String(
20222019
params.range.end.line.to_string(),
20232020
),

crates/project/src/lsp_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6844,7 +6844,7 @@ impl LspStore {
68446844
&& range.start.is_valid(&buffer_snapshot)
68456845
&& range.end.is_valid(&buffer_snapshot)
68466846
&& hint.position.cmp(&range.start, &buffer_snapshot).is_ge()
6847-
&& hint.position.cmp(&range.end, &buffer_snapshot).is_le()
6847+
&& hint.position.cmp(&range.end, &buffer_snapshot).is_lt()
68486848
});
68496849
(server_id, new_hints)
68506850
})

0 commit comments

Comments
 (0)