From 93c7afc4ed2b8d848fa2779f43202ba7f837263b Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Sat, 11 Feb 2023 07:50:01 +0100 Subject: Negotiate LSP Position Encoding (#5894) So far LSP always required that `PositionEncoding.characters` is an UTF-16 offset. Now that LSP 3.17 is available in `lsp-types` request the server to send char offsets (UTF-32) or byte offsets (UTF-8) instead. For compatability with old servers, UTF-16 remains as the fallback as required by the standard.--- helix-term/src/commands/lsp.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index d12aa436..d1fb32a8 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -1,7 +1,10 @@ use futures_util::FutureExt; use helix_lsp::{ block_on, - lsp::{self, CodeAction, CodeActionOrCommand, DiagnosticSeverity, NumberOrString}, + lsp::{ + self, CodeAction, CodeActionOrCommand, CodeActionTriggerKind, DiagnosticSeverity, + NumberOrString, + }, util::{diagnostic_to_lsp_diagnostic, lsp_pos_to_pos, lsp_range_to_range, range_to_lsp_range}, OffsetEncoding, }; @@ -561,6 +564,7 @@ pub fn code_action(cx: &mut Context) { .map(|diag| diagnostic_to_lsp_diagnostic(doc.text(), diag, offset_encoding)) .collect(), only: None, + trigger_kind: Some(CodeActionTriggerKind::INVOKED), }, ) { Some(future) => future, -- cgit v1.2.3-70-g09d2