Skip to content

Commit

Permalink
Retry inlay hint requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Apr 28, 2024
1 parent 29cd3a8 commit c973701
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion crates/rust-analyzer/src/handlers/request.rs
Expand Up @@ -937,7 +937,7 @@ pub(crate) fn handle_completion(
lsp_types::CompletionParams { text_document_position, context,.. }: lsp_types::CompletionParams,
) -> anyhow::Result<Option<lsp_types::CompletionResponse>> {
let _p = tracing::span!(tracing::Level::INFO, "handle_completion").entered();
let mut position = from_proto::file_position(&snap, text_document_position)?;
let mut position = from_proto::file_position(&snap, text_document_position.clone())?;
let line_index = snap.file_line_index(position.file_id)?;
let completion_trigger_character =
context.and_then(|ctx| ctx.trigger_character).and_then(|s| s.chars().next());
Expand Down Expand Up @@ -1505,6 +1505,10 @@ pub(crate) fn handle_inlay_hints(
)?;
let line_index = snap.file_line_index(file_id)?;
let source_root = snap.analysis.source_root(file_id)?;
let range = TextRange::new(
range.start().max(line_index.index.len()),
range.end().max(line_index.index.len()),
);

let inlay_hints_config = snap.config.inlay_hints(Some(source_root));
Ok(Some(
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/main_loop.rs
Expand Up @@ -947,7 +947,7 @@ impl GlobalState {
.on::<NO_RETRY, lsp_request::GotoDeclaration>(handlers::handle_goto_declaration)
.on::<NO_RETRY, lsp_request::GotoImplementation>(handlers::handle_goto_implementation)
.on::<NO_RETRY, lsp_request::GotoTypeDefinition>(handlers::handle_goto_type_definition)
.on::<NO_RETRY, lsp_request::InlayHintRequest>(handlers::handle_inlay_hints)
.on::<RETRY, lsp_request::InlayHintRequest>(handlers::handle_inlay_hints)
.on::<RETRY, lsp_request::InlayHintResolveRequest>(handlers::handle_inlay_hints_resolve)
.on::<NO_RETRY, lsp_request::CodeLensRequest>(handlers::handle_code_lens)
.on::<RETRY, lsp_request::CodeLensResolve>(handlers::handle_code_lens_resolve)
Expand Down

0 comments on commit c973701

Please sign in to comment.