-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing field range #13503
Comments
Which client is that from? Does it reproduce reliably? The request looks fine as far as I can tell.. |
it's from neovim |
I'm not sure if some things could be removed (not very good with rust yet) { {
error = {
code = -32602,
message = "Failed to deserialize textDocument/codeAction: missing field `range`; {\"textDocument\":{\"uri\":\"file:///Users/max/programming/rust/algorithms/src/fuzzy.rs\"},\"context\":{\"diagnostics\":[{\"end_col\":33,\"code\":\"E0381\",\"message\":\"used binding `options` isn't initialized\\n`options` used here but it isn't initialized\",\"namespace\":33,\"bufnr\":1,\"severity\":1,\"lnum\":16,\"col\":19,\"end_lnum\":16,\"user_data\":{\"lsp\":{\"codeDescription\":{\"href\":\"https://doc.rust-lang.org/error-index.html#E0381\"},\"relatedInformation\":[{\"location\":{\"range\":{\"start\":{\"line\":15,\"character\":8},\"end\":{\"line\":15,\"character\":15}},\"uri\":\"file:///Users/max/programming/rust/algorithms/src/fuzzy.rs\"},\"message\":\"binding declared here but left uninitialized\"},{\"location\":{\"range\":{\"start\":{\"line\":15,\"character\":25},\"end\":{\"line\":15,\"character\":25}},\"uri\":\"file:///Users/max/programming/rust/algorithms/src/fuzzy.rs\"},\"message\":\"consider assigning a value: ` = vec![]`\"}],\"code\":\"E0381\"}},\"source\":\"rustc\"}]},\"range\":{\"start\":{\"line\":16,\"character\":24},\"end\":{\"line\":16,\"character\":24}}}",
<metatable> = {
__tostring = <function 1>
}
}
} } src/main.rs mod fuzzy;
fn main() {
let x = "kitten";
let y= "sitting";
println!(
"The levensheit distance between {} and {} is {}",
x,
y,
fuzzy::levenshtein_distance_recursive(String::from("kitten"), String::from("sitting"))
);
} src/fuzzy.rs // https://en.wikipedia.org/wiki/Levenshtein_distance
pub fn levenshtein_distance_recursive(a: String, b: String) -> u32 {
if a.is_empty() {
return b.len().try_into().unwrap();
} else if b.is_empty() {
return a.len().try_into().unwrap();
}
if a[0..1] == b[0..1] {
return levenshtein_distance_recursive(a[1..].to_string(), b[1..].to_string());
}
// let options: Vec<u32> = vec![
// levenshtein_distance_recursive(a[1..].to_string(), b.clone()),
// levenshtein_distance_recursive(a.clone(), b[1..].to_string()),
// levenshtein_distance_recursive(a[1..].to_string(), b[1..].to_string()),
// ];
let options: Vec<u32>;
let smallest = options.iter().min(); // cursor is on this line on `options`
match smallest {
None => {
panic!("Some error occured")
}
Some(i) => 1 + *i,
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm getting this return value from a code action request:
even though there is a
range
fieldThe text was updated successfully, but these errors were encountered: