Skip to content

Commit 495afd1

Browse files
committed
Retry inlay hint requests
1 parent e379766 commit 495afd1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ pub(crate) fn handle_completion(
937937
lsp_types::CompletionParams { text_document_position, context,.. }: lsp_types::CompletionParams,
938938
) -> anyhow::Result<Option<lsp_types::CompletionResponse>> {
939939
let _p = tracing::span!(tracing::Level::INFO, "handle_completion").entered();
940-
let mut position = from_proto::file_position(&snap, text_document_position)?;
940+
let mut position = from_proto::file_position(&snap, text_document_position.clone())?;
941941
let line_index = snap.file_line_index(position.file_id)?;
942942
let completion_trigger_character =
943943
context.and_then(|ctx| ctx.trigger_character).and_then(|s| s.chars().next());
@@ -1505,6 +1505,10 @@ pub(crate) fn handle_inlay_hints(
15051505
)?;
15061506
let line_index = snap.file_line_index(file_id)?;
15071507
let source_root = snap.analysis.source_root(file_id)?;
1508+
let range = TextRange::new(
1509+
range.start().min(line_index.index.len()),
1510+
range.end().min(line_index.index.len()),
1511+
);
15081512

15091513
let inlay_hints_config = snap.config.inlay_hints(Some(source_root));
15101514
Ok(Some(

src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ impl GlobalState {
947947
.on::<NO_RETRY, lsp_request::GotoDeclaration>(handlers::handle_goto_declaration)
948948
.on::<NO_RETRY, lsp_request::GotoImplementation>(handlers::handle_goto_implementation)
949949
.on::<NO_RETRY, lsp_request::GotoTypeDefinition>(handlers::handle_goto_type_definition)
950-
.on::<NO_RETRY, lsp_request::InlayHintRequest>(handlers::handle_inlay_hints)
950+
.on::<RETRY, lsp_request::InlayHintRequest>(handlers::handle_inlay_hints)
951951
.on::<RETRY, lsp_request::InlayHintResolveRequest>(handlers::handle_inlay_hints_resolve)
952952
.on::<NO_RETRY, lsp_request::CodeLensRequest>(handlers::handle_code_lens)
953953
.on::<RETRY, lsp_request::CodeLensResolve>(handlers::handle_code_lens_resolve)

0 commit comments

Comments
 (0)