Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | crates/rust-analyzer/src/handlers/request.rs | 6 | ||||
| -rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs index 88dac17d6e..90851ac7c5 100644 --- a/crates/rust-analyzer/src/handlers/request.rs +++ b/crates/rust-analyzer/src/handlers/request.rs @@ -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()); @@ -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().min(line_index.index.len()), + range.end().min(line_index.index.len()), + ); let inlay_hints_config = snap.config.inlay_hints(Some(source_root)); Ok(Some( diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 9c1d955dd7..aee3162308 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -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) |