Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | crates/rust-analyzer/Cargo.toml | 2 | ||||
| -rw-r--r-- | crates/rust-analyzer/src/handlers/request.rs | 6 | ||||
| -rw-r--r-- | crates/rust-analyzer/tests/slow-tests/main.rs | 21 | ||||
| -rw-r--r-- | lib/lsp-server/Cargo.toml | 2 |
5 files changed, 18 insertions, 17 deletions
diff --git a/Cargo.lock b/Cargo.lock index b080eab693..ef35ff3e7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -695,9 +695,9 @@ dependencies = [ [[package]] name = "gen-lsp-types" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd635c5206acd03ea024d6b5902539e5c903de3afa220fdb5c94b583af77f4f" +checksum = "b64887ac3a8083427ae935a7296db876871582cd57eac077564f8bc18fa49116" dependencies = [ "serde", "serde_json", diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index f08eb11769..d94b95cfc9 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -29,7 +29,7 @@ ide-completion.workspace = true indexmap.workspace = true itertools.workspace = true scip = "0.7.1" -lsp-types = { version = "0.10.0", package = "gen-lsp-types", features = ["url"] } +lsp-types = { version = "0.11.0", package = "gen-lsp-types", features = ["url"] } parking_lot = "0.12.4" xflags = "0.3.2" oorandom = "11.1.5" diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs index 41e3db7f31..ce4941786c 100644 --- a/crates/rust-analyzer/src/handlers/request.rs +++ b/crates/rust-analyzer/src/handlers/request.rs @@ -780,10 +780,7 @@ pub(crate) fn handle_will_rename_files( let source_changes: Vec<SourceChange> = params .files .into_iter() - .filter_map(|file_rename| { - let from = Uri::parse(&file_rename.old_uri).ok()?; - let to = Uri::parse(&file_rename.new_uri).ok()?; - + .filter_map(|lsp_types::FileRename { new_uri: to, old_uri: from }| { let from_path = from.to_file_path().ok()?; let to_path = to.to_file_path().ok()?; @@ -2726,6 +2723,7 @@ fn resource_ops_supported(config: &Config, kind: &DocumentChange) -> anyhow::Res ResourceOperationKind::Create => "create", ResourceOperationKind::Rename => "rename", ResourceOperationKind::Delete => "delete", + ResourceOperationKind::Custom(_) => unreachable!(), } ), ) diff --git a/crates/rust-analyzer/tests/slow-tests/main.rs b/crates/rust-analyzer/tests/slow-tests/main.rs index 9edb1df447..56629f79ea 100644 --- a/crates/rust-analyzer/tests/slow-tests/main.rs +++ b/crates/rust-analyzer/tests/slow-tests/main.rs @@ -30,7 +30,8 @@ use lsp_types::{ FileRename, FormattingOptions, HoverParams, HoverRequest, InlayHint, InlayHintParams, InlayHintRequest, InlayHintResolveRequest, Label, LanguageKind, PartialResultParams, Position, Range, RenameFilesParams, TextDocumentItem, TextDocumentPositionParams, TypeDefinitionParams, - TypeDefinitionRequest, WillRenameFilesRequest, WorkDoneProgressParams, WorkspaceSymbolRequest, + TypeDefinitionRequest, Uri, WillRenameFilesRequest, WorkDoneProgressParams, + WorkspaceSymbolRequest, }; use rust_analyzer::lsp::ext::{OnEnterRequest, RunnablesParams, RunnablesRequest}; use serde_json::json; @@ -1304,8 +1305,8 @@ use crate::old_folder::nested::foo as bar; server.request::<WillRenameFilesRequest>( RenameFilesParams { files: vec![FileRename { - old_uri: base_path.join("src/old_file.rs").to_str().unwrap().to_owned(), - new_uri: base_path.join("src/new_file.rs").to_str().unwrap().to_owned(), + old_uri: Uri::parse(base_path.join("src/old_file.rs").to_str().unwrap()).unwrap(), + new_uri: Uri::parse(base_path.join("src/new_file.rs").to_str().unwrap()).unwrap(), }], }, json!({ @@ -1339,8 +1340,10 @@ use crate::old_folder::nested::foo as bar; server.request::<WillRenameFilesRequest>( RenameFilesParams { files: vec![FileRename { - old_uri: base_path.join("src/from_mod/mod.rs").to_str().unwrap().to_owned(), - new_uri: base_path.join("src/from_mod/foo.rs").to_str().unwrap().to_owned(), + old_uri: Uri::parse(base_path.join("src/from_mod/mod.rs").to_str().unwrap()) + .unwrap(), + new_uri: Uri::parse(base_path.join("src/from_mod/foo.rs").to_str().unwrap()) + .unwrap(), }], }, json!(null), @@ -1350,8 +1353,8 @@ use crate::old_folder::nested::foo as bar; server.request::<WillRenameFilesRequest>( RenameFilesParams { files: vec![FileRename { - old_uri: base_path.join("src/to_mod/foo.rs").to_str().unwrap().to_owned(), - new_uri: base_path.join("src/to_mod/mod.rs").to_str().unwrap().to_owned(), + old_uri: Uri::parse(base_path.join("src/to_mod/foo.rs").to_str().unwrap()).unwrap(), + new_uri: Uri::parse(base_path.join("src/to_mod/mod.rs").to_str().unwrap()).unwrap(), }], }, json!(null), @@ -1361,8 +1364,8 @@ use crate::old_folder::nested::foo as bar; server.request::<WillRenameFilesRequest>( RenameFilesParams { files: vec![FileRename { - old_uri: base_path.join("src/old_folder").to_str().unwrap().to_owned(), - new_uri: base_path.join("src/new_folder").to_str().unwrap().to_owned(), + old_uri: Uri::parse(base_path.join("src/old_folder").to_str().unwrap()).unwrap(), + new_uri: Uri::parse(base_path.join("src/new_folder").to_str().unwrap()).unwrap(), }], }, json!({ diff --git a/lib/lsp-server/Cargo.toml b/lib/lsp-server/Cargo.toml index 8b8617f975..7d2e1b816b 100644 --- a/lib/lsp-server/Cargo.toml +++ b/lib/lsp-server/Cargo.toml @@ -17,7 +17,7 @@ lsp-types = { version = "0.10.0", package = "gen-lsp-types", features = [ ] } [dev-dependencies] -lsp-types = { version = "0.10.0", package = "gen-lsp-types", features = [ +lsp-types = { version = "0.11.0", package = "gen-lsp-types", features = [ "url", ] } ctrlc = "3.4.7" |