aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorPascal Kuthe2023-02-11 06:50:01 +0000
committerGitHub2023-02-11 06:50:01 +0000
commit93c7afc4ed2b8d848fa2779f43202ba7f837263b (patch)
tree866e07e173686a41b5f164ee40b63b585037232a /helix-term
parent6929a12f291fa5dee50cde9c89845b206b7333fd (diff)
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.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands/lsp.rs6
1 files changed, 5 insertions, 1 deletions
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,