Skip to content

Commit 9d68707

Browse files
h-michaelautozimu
authored andcommitted
Bumpup lsp_typs from v0.54.0 to v0.56.0
1 parent 421f0d3 commit 9d68707

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ serde_json = "1"
1919
crossbeam-channel = "0.3"
2020

2121
jsonrpc-core = "10"
22-
lsp-types = "0.54"
22+
lsp-types = "0.56"
2323
url = "1"
2424
pathdiff = "0"
2525
diff = "0"

src/language_server_protocol.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,13 +1330,23 @@ impl LanguageClient {
13301330
if help.signatures.is_empty() {
13311331
return Ok(Value::Null);
13321332
}
1333+
1334+
// active_signature may be negative value.
1335+
// So if it is negative value, we convert it into zero.
1336+
let active_signature_index = help.active_signature.unwrap_or(0).max(0) as usize;
1337+
13331338
let active_signature = help
13341339
.signatures
1335-
.get(help.active_signature.unwrap_or(0).to_usize()?)
1340+
.get(active_signature_index)
13361341
.ok_or_else(|| err_msg("Failed to get active signature"))?;
1342+
1343+
// active_signature may be negative value.
1344+
// So if it is negative value, we convert it into zero.
1345+
let active_parameter_index = help.active_parameter.unwrap_or(0).max(0) as usize;
1346+
13371347
let active_parameter: Option<&ParameterInformation>;
13381348
if let Some(ref parameters) = active_signature.parameters {
1339-
active_parameter = parameters.get(help.active_parameter.unwrap_or(0).to_usize()?);
1349+
active_parameter = parameters.get(active_parameter_index);
13401350
} else {
13411351
active_parameter = None;
13421352
}

0 commit comments

Comments
 (0)