Comments (3)
proposed upstream fix is at rust-lang/rust-analyzer#17003
if you need a workaround, you can use our offset_encoding
config value (needs below fix unfortunately):
From a54e5f9c3297e2882e8dced8e78a49a85e026f29 Mon Sep 17 00:00:00 2001
From: Johannes Altmanninger <[email protected]>
Date: Wed, 3 Apr 2024 14:57:20 +0200
Subject: [PATCH 1/2] If offset_encoding is explicitly specified, always use
that
It looks like when we ask rust-analyzer that we prefer utf-16 but
tell it that we also support utf-8, it will ignore our preference and
always use utf-8. I think this violates LSP; I'm not sure if we want to
work around it like below (because that might make user errors worse)
---
src/capabilities.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/capabilities.rs b/src/capabilities.rs
index b19cb77..9e72f24 100644
--- a/src/capabilities.rs
+++ b/src/capabilities.rs
@@ -362,17 +362,17 @@ pub fn initialize(meta: EditorMeta, ctx: &mut Context) {
}),
stale_request_support: None,
position_encodings: Some(match preferred_offset_encoding {
- None | Some(OffsetEncoding::Utf8) => {
+ None => {
vec![
PositionEncodingKind::UTF8,
PositionEncodingKind::UTF16,
]
}
+ Some(OffsetEncoding::Utf8) => {
+ vec![PositionEncodingKind::UTF8]
+ }
Some(OffsetEncoding::Utf16) => {
- vec![
- PositionEncodingKind::UTF16,
- PositionEncodingKind::UTF8,
- ]
+ vec![PositionEncodingKind::UTF16]
}
}),
}),
--
2.44.0.413.gd6fd04375f
From 9e3600961c690f52e5a5219c8b93472ec4c093a1 Mon Sep 17 00:00:00 2001
From: Johannes Altmanninger <[email protected]>
Date: Wed, 3 Apr 2024 14:59:41 +0200
Subject: [PATCH 2/2] Use utf-16 position encoding for rust-analyzer
---
kak-lsp.toml | 1 +
1 file changed, 1 insertion(+)
diff --git a/kak-lsp.toml b/kak-lsp.toml
index f194628..e2fabd3 100644
--- a/kak-lsp.toml
+++ b/kak-lsp.toml
@@ -369,6 +369,7 @@ command = "ocamllsp"
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "rust-analyzer"
+offset_encoding = "utf-16"
# command = "sh"
# args = [
# "-c",
--
2.44.0.413.gd6fd04375f
from kakoune-lsp.
Thanks! Should I close this issue then?
from kakoune-lsp.
yeah I think so
from kakoune-lsp.
Related Issues (20)
- Unable to select message response, quoting issue? HOT 7
- LSP not start properly when receiving a line break at the end of stdout output HOT 1
- `vscode-html-language-server` etc. are incorrectly configured by default HOT 2
- `vscode-html-language-server` blocks Kakoune indefinitely on `lsp-formatting-sync` HOT 1
- gopls inlay hints HOT 3
- LSP not working for rust-analyzer HOT 12
- Extract response from kak-lsp HOT 6
- 'rename-client': client name 'global' is not unique HOT 5
- gopls: evaluate-commands wrong argument count HOT 1
- Unused dependency unindent
- Feature Request: Support modifying CodeActionContext HOT 7
- `lsp-code-actions` seems to be broken since `v16.0.0`. HOT 12
- SIGSEGV on lsp-goto-document-symbol HOT 3
- Lexical LS does not load. HOT 5
- Add Biome to example config HOT 2
- Add `zk` to example config HOT 4
- Add Svelte to example config
- Run the LSP only when the roots is found HOT 1
- Could it be possible to parse new lines (or markdown) on the hover information? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kakoune-lsp.