Completion replace not fully replacing when in macro string literal #11020
-
SummaryWhen trying to add the Not sure if its related but #10689 also seems to be an off-by-one, with that pointing to #10279 that was a fix for an off-by-one. Reproduction Stepscompletion-replace = true [dependencies]
serde = { version = "1", features = ["derive"]}
chrono ={ version = "0.4", features = ["serde"]} use chrono::serde::ts_milliseconds;
use chrono::{DateTime, Utc};
use serde::Deserialize;
#[derive(Deserialize)]
struct A {
#[serde(with = "tts_milliseconds")]
time: DateTime<Utc>,
}
fn main() {
println!("Hello, world!");
} Helix log~/.cache/helix/helix.log
PlatformWIndows Terminal EmulatorAlacritty Installation Methodsource Helix Version24.03-218-g9b7dffbd |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
this loooks like a rust-analyzer bug. Lsp has two modes of returning completion edits: One simple mode where the lsp has to figure out what text to replace and an explicit mode where the lsp specifies the range. RA always uses the explicit mode and all the setting does is switch between the two edits. In this case the edit RA provides is simply off by one so it's an off by one bug in rust-analyzer not in helix. Particularly these completions inside derive macros are new so I am not too surprised. It may also be a RA limitation since sered uses string literals. A better case is you start with a file where the word is partially already written out and enter insertmode (so entirely new completion). use chrono::serde::ts_milliseconds;
use chrono::{DateTime, Utc};
use serde::Deserialize;
#[derive(Deserialize)]
struct A {
#[serde(with = "ts_mill")]
time: DateTime<Utc>,
}
fn main() {
println!("Hello, world!");
} it completes |
Beta Was this translation helpful? Give feedback.
this loooks like a rust-analyzer bug. Lsp has two modes of returning completion edits: One simple mode where the lsp has to figure out what text to replace and an explicit mode where the lsp specifies the range.
RA always uses the explicit mode and all the setting does is switch between the two edits. In this case the edit RA provides is simply off by one so it's an off by one bug in rust-analyzer not in helix. Particularly these completions inside derive macros are new so I am not too surprised. It may also be a RA limitation since sered uses string literals.
A better case is you start with a file where the word is partially already written out and enter insertmode (so entirely new compl…