aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock32
-rw-r--r--crates/ide/Cargo.toml2
-rw-r--r--crates/ide/src/lib.rs7
-rw-r--r--crates/ide_ssr/Cargo.toml (renamed from crates/ssr/Cargo.toml)2
-rw-r--r--crates/ide_ssr/src/errors.rs (renamed from crates/ssr/src/errors.rs)0
-rw-r--r--crates/ide_ssr/src/lib.rs (renamed from crates/ssr/src/lib.rs)0
-rw-r--r--crates/ide_ssr/src/matching.rs (renamed from crates/ssr/src/matching.rs)0
-rw-r--r--crates/ide_ssr/src/nester.rs (renamed from crates/ssr/src/nester.rs)0
-rw-r--r--crates/ide_ssr/src/parsing.rs (renamed from crates/ssr/src/parsing.rs)0
-rw-r--r--crates/ide_ssr/src/replacing.rs (renamed from crates/ssr/src/replacing.rs)0
-rw-r--r--crates/ide_ssr/src/resolving.rs (renamed from crates/ssr/src/resolving.rs)0
-rw-r--r--crates/ide_ssr/src/search.rs (renamed from crates/ssr/src/search.rs)0
-rw-r--r--crates/ide_ssr/src/tests.rs (renamed from crates/ssr/src/tests.rs)0
-rw-r--r--crates/rust-analyzer/Cargo.toml2
-rw-r--r--crates/rust-analyzer/src/bin/args.rs2
-rw-r--r--crates/rust-analyzer/src/cli/ssr.rs2
16 files changed, 25 insertions, 24 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 477440f5f..e101ce4af 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -592,6 +592,7 @@ dependencies = [
592 "ide_assists", 592 "ide_assists",
593 "ide_completion", 593 "ide_completion",
594 "ide_db", 594 "ide_db",
595 "ide_ssr",
595 "indexmap", 596 "indexmap",
596 "itertools 0.10.0", 597 "itertools 0.10.0",
597 "log", 598 "log",
@@ -600,7 +601,6 @@ dependencies = [
600 "pulldown-cmark", 601 "pulldown-cmark",
601 "pulldown-cmark-to-cmark", 602 "pulldown-cmark-to-cmark",
602 "rustc-hash", 603 "rustc-hash",
603 "ssr",
604 "stdx", 604 "stdx",
605 "syntax", 605 "syntax",
606 "test_utils", 606 "test_utils",
@@ -666,6 +666,20 @@ dependencies = [
666] 666]
667 667
668[[package]] 668[[package]]
669name = "ide_ssr"
670version = "0.0.0"
671dependencies = [
672 "expect-test",
673 "hir",
674 "ide_db",
675 "itertools 0.10.0",
676 "rustc-hash",
677 "syntax",
678 "test_utils",
679 "text_edit",
680]
681
682[[package]]
669name = "idna" 683name = "idna"
670version = "0.2.2" 684version = "0.2.2"
671source = "registry+https://github.com/rust-lang/crates.io-index" 685source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1348,6 +1362,7 @@ dependencies = [
1348 "hir_ty", 1362 "hir_ty",
1349 "ide", 1363 "ide",
1350 "ide_db", 1364 "ide_db",
1365 "ide_ssr",
1351 "itertools 0.10.0", 1366 "itertools 0.10.0",
1352 "jemallocator", 1367 "jemallocator",
1353 "jod-thread", 1368 "jod-thread",
@@ -1367,7 +1382,6 @@ dependencies = [
1367 "serde", 1382 "serde",
1368 "serde_json", 1383 "serde_json",
1369 "serde_path_to_error", 1384 "serde_path_to_error",
1370 "ssr",
1371 "stdx", 1385 "stdx",
1372 "syntax", 1386 "syntax",
1373 "test_utils", 1387 "test_utils",
@@ -1573,20 +1587,6 @@ dependencies = [
1573] 1587]
1574 1588
1575[[package]] 1589[[package]]
1576name = "ssr"
1577version = "0.0.0"
1578dependencies = [
1579 "expect-test",
1580 "hir",
1581 "ide_db",
1582 "itertools 0.10.0",
1583 "rustc-hash",
1584 "syntax",
1585 "test_utils",
1586 "text_edit",
1587]
1588
1589[[package]]
1590name = "stdx" 1590name = "stdx"
1591version = "0.0.0" 1591version = "0.0.0"
1592dependencies = [ 1592dependencies = [
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml
index b7152c839..f6aaaeda4 100644
--- a/crates/ide/Cargo.toml
+++ b/crates/ide/Cargo.toml
@@ -28,7 +28,7 @@ cfg = { path = "../cfg", version = "0.0.0" }
28profile = { path = "../profile", version = "0.0.0" } 28profile = { path = "../profile", version = "0.0.0" }
29test_utils = { path = "../test_utils", version = "0.0.0" } 29test_utils = { path = "../test_utils", version = "0.0.0" }
30ide_assists = { path = "../ide_assists", version = "0.0.0" } 30ide_assists = { path = "../ide_assists", version = "0.0.0" }
31ssr = { path = "../ssr", version = "0.0.0" } 31ide_ssr = { path = "../ide_ssr", version = "0.0.0" }
32ide_completion = { path = "../ide_completion", version = "0.0.0" } 32ide_completion = { path = "../ide_completion", version = "0.0.0" }
33 33
34# ide should depend only on the top-level `hir` package. if you need 34# ide should depend only on the top-level `hir` package. if you need
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index eb26d13b9..b600178ee 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -101,7 +101,7 @@ pub use ide_db::{
101 symbol_index::Query, 101 symbol_index::Query,
102 RootDatabase, 102 RootDatabase,
103}; 103};
104pub use ssr::SsrError; 104pub use ide_ssr::SsrError;
105pub use syntax::{TextRange, TextSize}; 105pub use syntax::{TextRange, TextSize};
106pub use text_edit::{Indel, TextEdit}; 106pub use text_edit::{Indel, TextEdit};
107 107
@@ -549,8 +549,9 @@ impl Analysis {
549 selections: Vec<FileRange>, 549 selections: Vec<FileRange>,
550 ) -> Cancelable<Result<SourceChange, SsrError>> { 550 ) -> Cancelable<Result<SourceChange, SsrError>> {
551 self.with_db(|db| { 551 self.with_db(|db| {
552 let rule: ssr::SsrRule = query.parse()?; 552 let rule: ide_ssr::SsrRule = query.parse()?;
553 let mut match_finder = ssr::MatchFinder::in_context(db, resolve_context, selections); 553 let mut match_finder =
554 ide_ssr::MatchFinder::in_context(db, resolve_context, selections);
554 match_finder.add_rule(rule)?; 555 match_finder.add_rule(rule)?;
555 let edits = if parse_only { Default::default() } else { match_finder.edits() }; 556 let edits = if parse_only { Default::default() } else { match_finder.edits() };
556 Ok(SourceChange::from(edits)) 557 Ok(SourceChange::from(edits))
diff --git a/crates/ssr/Cargo.toml b/crates/ide_ssr/Cargo.toml
index cc8136d22..edbc1846b 100644
--- a/crates/ssr/Cargo.toml
+++ b/crates/ide_ssr/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2name = "ssr" 2name = "ide_ssr"
3version = "0.0.0" 3version = "0.0.0"
4description = "Structural search and replace of Rust code" 4description = "Structural search and replace of Rust code"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
diff --git a/crates/ssr/src/errors.rs b/crates/ide_ssr/src/errors.rs
index c02bacae6..c02bacae6 100644
--- a/crates/ssr/src/errors.rs
+++ b/crates/ide_ssr/src/errors.rs
diff --git a/crates/ssr/src/lib.rs b/crates/ide_ssr/src/lib.rs
index a97fc8bca..a97fc8bca 100644
--- a/crates/ssr/src/lib.rs
+++ b/crates/ide_ssr/src/lib.rs
diff --git a/crates/ssr/src/matching.rs b/crates/ide_ssr/src/matching.rs
index df013bae9..df013bae9 100644
--- a/crates/ssr/src/matching.rs
+++ b/crates/ide_ssr/src/matching.rs
diff --git a/crates/ssr/src/nester.rs b/crates/ide_ssr/src/nester.rs
index 6ac355dfc..6ac355dfc 100644
--- a/crates/ssr/src/nester.rs
+++ b/crates/ide_ssr/src/nester.rs
diff --git a/crates/ssr/src/parsing.rs b/crates/ide_ssr/src/parsing.rs
index 3d5e4feb7..3d5e4feb7 100644
--- a/crates/ssr/src/parsing.rs
+++ b/crates/ide_ssr/src/parsing.rs
diff --git a/crates/ssr/src/replacing.rs b/crates/ide_ssr/src/replacing.rs
index 06a94a46c..06a94a46c 100644
--- a/crates/ssr/src/replacing.rs
+++ b/crates/ide_ssr/src/replacing.rs
diff --git a/crates/ssr/src/resolving.rs b/crates/ide_ssr/src/resolving.rs
index 14e5a3b69..14e5a3b69 100644
--- a/crates/ssr/src/resolving.rs
+++ b/crates/ide_ssr/src/resolving.rs
diff --git a/crates/ssr/src/search.rs b/crates/ide_ssr/src/search.rs
index 836eb94b2..836eb94b2 100644
--- a/crates/ssr/src/search.rs
+++ b/crates/ide_ssr/src/search.rs
diff --git a/crates/ssr/src/tests.rs b/crates/ide_ssr/src/tests.rs
index a3ea44f23..a3ea44f23 100644
--- a/crates/ssr/src/tests.rs
+++ b/crates/ide_ssr/src/tests.rs
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 2a5cd59f9..b881cc229 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -53,7 +53,7 @@ cfg = { path = "../cfg", version = "0.0.0" }
53toolchain = { path = "../toolchain", version = "0.0.0" } 53toolchain = { path = "../toolchain", version = "0.0.0" }
54 54
55# This should only be used in CLI 55# This should only be used in CLI
56ssr = { path = "../ssr", version = "0.0.0" } 56ide_ssr = { path = "../ide_ssr", version = "0.0.0" }
57hir = { path = "../hir", version = "0.0.0" } 57hir = { path = "../hir", version = "0.0.0" }
58hir_def = { path = "../hir_def", version = "0.0.0" } 58hir_def = { path = "../hir_def", version = "0.0.0" }
59hir_ty = { path = "../hir_ty", version = "0.0.0" } 59hir_ty = { path = "../hir_ty", version = "0.0.0" }
diff --git a/crates/rust-analyzer/src/bin/args.rs b/crates/rust-analyzer/src/bin/args.rs
index 3a7db6a18..164d94a30 100644
--- a/crates/rust-analyzer/src/bin/args.rs
+++ b/crates/rust-analyzer/src/bin/args.rs
@@ -6,9 +6,9 @@
6use std::{env, path::PathBuf}; 6use std::{env, path::PathBuf};
7 7
8use anyhow::{bail, format_err, Result}; 8use anyhow::{bail, format_err, Result};
9use ide_ssr::{SsrPattern, SsrRule};
9use pico_args::Arguments; 10use pico_args::Arguments;
10use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity}; 11use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity};
11use ssr::{SsrPattern, SsrRule};
12use vfs::AbsPathBuf; 12use vfs::AbsPathBuf;
13 13
14pub(crate) struct Args { 14pub(crate) struct Args {
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs
index 71c61ed58..71a8f8fb9 100644
--- a/crates/rust-analyzer/src/cli/ssr.rs
+++ b/crates/rust-analyzer/src/cli/ssr.rs
@@ -4,7 +4,7 @@ use crate::cli::{
4 load_cargo::{load_workspace_at, LoadCargoConfig}, 4 load_cargo::{load_workspace_at, LoadCargoConfig},
5 Result, 5 Result,
6}; 6};
7use ssr::{MatchFinder, SsrPattern, SsrRule}; 7use ide_ssr::{MatchFinder, SsrPattern, SsrRule};
8 8
9pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { 9pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
10 use ide_db::base_db::SourceDatabaseExt; 10 use ide_db::base_db::SourceDatabaseExt;