Fix SelectionRange return type

This commit is contained in:
kjeremy 2020-03-09 10:17:16 -04:00
parent bf3eef8897
commit c981c8b0d0
4 changed files with 9 additions and 7 deletions

4
Cargo.lock generated
View file

@ -655,9 +655,9 @@ dependencies = [
[[package]] [[package]]
name = "lsp-types" name = "lsp-types"
version = "0.72.0" version = "0.73.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "face91691e558746745dc9dc6c67a4e2a24e044926e274d8378e6f19659329f0" checksum = "93d0cf64ea141b43d9e055f6b9df13f0bce32b103d84237509ce0a571ab9b159"
dependencies = [ dependencies = [
"base64", "base64",
"bitflags", "bitflags",

View file

@ -6,7 +6,7 @@ authors = ["rust-analyzer developers"]
[dependencies] [dependencies]
crossbeam-channel = "0.4.0" crossbeam-channel = "0.4.0"
lsp-types = { version = "0.72.0", features = ["proposed"] } lsp-types = { version = "0.73.0", features = ["proposed"] }
log = "0.4.8" log = "0.4.8"
cargo_metadata = "0.9.1" cargo_metadata = "0.9.1"
serde_json = "1.0.48" serde_json = "1.0.48"

View file

@ -20,7 +20,7 @@ globset = "0.4.4"
itertools = "0.8.2" itertools = "0.8.2"
jod-thread = "0.1.0" jod-thread = "0.1.0"
log = "0.4.8" log = "0.4.8"
lsp-types = { version = "0.72.0", features = ["proposed"] } lsp-types = { version = "0.73.0", features = ["proposed"] }
parking_lot = "0.10.0" parking_lot = "0.10.0"
pico-args = "0.3.1" pico-args = "0.3.1"
rand = { version = "0.7.3", features = ["small_rng"] } rand = { version = "0.7.3", features = ["small_rng"] }

View file

@ -85,11 +85,11 @@ pub fn handle_expand_macro(
pub fn handle_selection_range( pub fn handle_selection_range(
world: WorldSnapshot, world: WorldSnapshot,
params: req::SelectionRangeParams, params: req::SelectionRangeParams,
) -> Result<Vec<req::SelectionRange>> { ) -> Result<Option<Vec<req::SelectionRange>>> {
let _p = profile("handle_selection_range"); let _p = profile("handle_selection_range");
let file_id = params.text_document.try_conv_with(&world)?; let file_id = params.text_document.try_conv_with(&world)?;
let line_index = world.analysis().file_line_index(file_id)?; let line_index = world.analysis().file_line_index(file_id)?;
params let res: Result<Vec<req::SelectionRange>> = params
.positions .positions
.into_iter() .into_iter()
.map_conv_with(&line_index) .map_conv_with(&line_index)
@ -120,7 +120,9 @@ pub fn handle_selection_range(
} }
Ok(range) Ok(range)
}) })
.collect() .collect();
Ok(Some(res?))
} }
pub fn handle_find_matching_brace( pub fn handle_find_matching_brace(