7526: Renamed create ssr to ide_ssr.

This commit is contained in:
Chetan Khilosiya 2021-02-23 00:44:58 +05:30
parent e4756cb4f6
commit eb6cfa7f15
16 changed files with 25 additions and 24 deletions

32
Cargo.lock generated
View file

@ -592,6 +592,7 @@ dependencies = [
"ide_assists",
"ide_completion",
"ide_db",
"ide_ssr",
"indexmap",
"itertools 0.10.0",
"log",
@ -600,7 +601,6 @@ dependencies = [
"pulldown-cmark",
"pulldown-cmark-to-cmark",
"rustc-hash",
"ssr",
"stdx",
"syntax",
"test_utils",
@ -665,6 +665,20 @@ dependencies = [
"text_edit",
]
[[package]]
name = "ide_ssr"
version = "0.0.0"
dependencies = [
"expect-test",
"hir",
"ide_db",
"itertools 0.10.0",
"rustc-hash",
"syntax",
"test_utils",
"text_edit",
]
[[package]]
name = "idna"
version = "0.2.2"
@ -1348,6 +1362,7 @@ dependencies = [
"hir_ty",
"ide",
"ide_db",
"ide_ssr",
"itertools 0.10.0",
"jemallocator",
"jod-thread",
@ -1367,7 +1382,6 @@ dependencies = [
"serde",
"serde_json",
"serde_path_to_error",
"ssr",
"stdx",
"syntax",
"test_utils",
@ -1572,20 +1586,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "ssr"
version = "0.0.0"
dependencies = [
"expect-test",
"hir",
"ide_db",
"itertools 0.10.0",
"rustc-hash",
"syntax",
"test_utils",
"text_edit",
]
[[package]]
name = "stdx"
version = "0.0.0"

View file

@ -28,7 +28,7 @@ cfg = { path = "../cfg", version = "0.0.0" }
profile = { path = "../profile", version = "0.0.0" }
test_utils = { path = "../test_utils", version = "0.0.0" }
ide_assists = { path = "../ide_assists", version = "0.0.0" }
ssr = { path = "../ssr", version = "0.0.0" }
ide_ssr = { path = "../ide_ssr", version = "0.0.0" }
ide_completion = { path = "../ide_completion", version = "0.0.0" }
# ide should depend only on the top-level `hir` package. if you need

View file

@ -101,7 +101,7 @@ pub use ide_db::{
symbol_index::Query,
RootDatabase,
};
pub use ssr::SsrError;
pub use ide_ssr::SsrError;
pub use syntax::{TextRange, TextSize};
pub use text_edit::{Indel, TextEdit};
@ -549,8 +549,9 @@ impl Analysis {
selections: Vec<FileRange>,
) -> Cancelable<Result<SourceChange, SsrError>> {
self.with_db(|db| {
let rule: ssr::SsrRule = query.parse()?;
let mut match_finder = ssr::MatchFinder::in_context(db, resolve_context, selections);
let rule: ide_ssr::SsrRule = query.parse()?;
let mut match_finder =
ide_ssr::MatchFinder::in_context(db, resolve_context, selections);
match_finder.add_rule(rule)?;
let edits = if parse_only { Default::default() } else { match_finder.edits() };
Ok(SourceChange::from(edits))

View file

@ -1,5 +1,5 @@
[package]
name = "ssr"
name = "ide_ssr"
version = "0.0.0"
description = "Structural search and replace of Rust code"
license = "MIT OR Apache-2.0"

View file

@ -53,7 +53,7 @@ cfg = { path = "../cfg", version = "0.0.0" }
toolchain = { path = "../toolchain", version = "0.0.0" }
# This should only be used in CLI
ssr = { path = "../ssr", version = "0.0.0" }
ide_ssr = { path = "../ide_ssr", version = "0.0.0" }
hir = { path = "../hir", version = "0.0.0" }
hir_def = { path = "../hir_def", version = "0.0.0" }
hir_ty = { path = "../hir_ty", version = "0.0.0" }

View file

@ -6,9 +6,9 @@
use std::{env, path::PathBuf};
use anyhow::{bail, format_err, Result};
use ide_ssr::{SsrPattern, SsrRule};
use pico_args::Arguments;
use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity};
use ssr::{SsrPattern, SsrRule};
use vfs::AbsPathBuf;
pub(crate) struct Args {

View file

@ -4,7 +4,7 @@ use crate::cli::{
load_cargo::{load_workspace_at, LoadCargoConfig},
Result,
};
use ssr::{MatchFinder, SsrPattern, SsrRule};
use ide_ssr::{MatchFinder, SsrPattern, SsrRule};
pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
use ide_db::base_db::SourceDatabaseExt;