mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 07:04:22 +00:00
7526: Renamed create ssr to ide_ssr.
This commit is contained in:
parent
e4756cb4f6
commit
eb6cfa7f15
16 changed files with 25 additions and 24 deletions
32
Cargo.lock
generated
32
Cargo.lock
generated
|
@ -592,6 +592,7 @@ dependencies = [
|
||||||
"ide_assists",
|
"ide_assists",
|
||||||
"ide_completion",
|
"ide_completion",
|
||||||
"ide_db",
|
"ide_db",
|
||||||
|
"ide_ssr",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools 0.10.0",
|
"itertools 0.10.0",
|
||||||
"log",
|
"log",
|
||||||
|
@ -600,7 +601,6 @@ dependencies = [
|
||||||
"pulldown-cmark",
|
"pulldown-cmark",
|
||||||
"pulldown-cmark-to-cmark",
|
"pulldown-cmark-to-cmark",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"ssr",
|
|
||||||
"stdx",
|
"stdx",
|
||||||
"syntax",
|
"syntax",
|
||||||
"test_utils",
|
"test_utils",
|
||||||
|
@ -665,6 +665,20 @@ dependencies = [
|
||||||
"text_edit",
|
"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]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
@ -1348,6 +1362,7 @@ dependencies = [
|
||||||
"hir_ty",
|
"hir_ty",
|
||||||
"ide",
|
"ide",
|
||||||
"ide_db",
|
"ide_db",
|
||||||
|
"ide_ssr",
|
||||||
"itertools 0.10.0",
|
"itertools 0.10.0",
|
||||||
"jemallocator",
|
"jemallocator",
|
||||||
"jod-thread",
|
"jod-thread",
|
||||||
|
@ -1367,7 +1382,6 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_path_to_error",
|
"serde_path_to_error",
|
||||||
"ssr",
|
|
||||||
"stdx",
|
"stdx",
|
||||||
"syntax",
|
"syntax",
|
||||||
"test_utils",
|
"test_utils",
|
||||||
|
@ -1572,20 +1586,6 @@ dependencies = [
|
||||||
"winapi",
|
"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]]
|
[[package]]
|
||||||
name = "stdx"
|
name = "stdx"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
|
|
@ -28,7 +28,7 @@ cfg = { path = "../cfg", version = "0.0.0" }
|
||||||
profile = { path = "../profile", version = "0.0.0" }
|
profile = { path = "../profile", version = "0.0.0" }
|
||||||
test_utils = { path = "../test_utils", version = "0.0.0" }
|
test_utils = { path = "../test_utils", version = "0.0.0" }
|
||||||
ide_assists = { path = "../ide_assists", 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_completion = { path = "../ide_completion", version = "0.0.0" }
|
||||||
|
|
||||||
# ide should depend only on the top-level `hir` package. if you need
|
# ide should depend only on the top-level `hir` package. if you need
|
||||||
|
|
|
@ -101,7 +101,7 @@ pub use ide_db::{
|
||||||
symbol_index::Query,
|
symbol_index::Query,
|
||||||
RootDatabase,
|
RootDatabase,
|
||||||
};
|
};
|
||||||
pub use ssr::SsrError;
|
pub use ide_ssr::SsrError;
|
||||||
pub use syntax::{TextRange, TextSize};
|
pub use syntax::{TextRange, TextSize};
|
||||||
pub use text_edit::{Indel, TextEdit};
|
pub use text_edit::{Indel, TextEdit};
|
||||||
|
|
||||||
|
@ -549,8 +549,9 @@ impl Analysis {
|
||||||
selections: Vec<FileRange>,
|
selections: Vec<FileRange>,
|
||||||
) -> Cancelable<Result<SourceChange, SsrError>> {
|
) -> Cancelable<Result<SourceChange, SsrError>> {
|
||||||
self.with_db(|db| {
|
self.with_db(|db| {
|
||||||
let rule: ssr::SsrRule = query.parse()?;
|
let rule: ide_ssr::SsrRule = query.parse()?;
|
||||||
let mut match_finder = ssr::MatchFinder::in_context(db, resolve_context, selections);
|
let mut match_finder =
|
||||||
|
ide_ssr::MatchFinder::in_context(db, resolve_context, selections);
|
||||||
match_finder.add_rule(rule)?;
|
match_finder.add_rule(rule)?;
|
||||||
let edits = if parse_only { Default::default() } else { match_finder.edits() };
|
let edits = if parse_only { Default::default() } else { match_finder.edits() };
|
||||||
Ok(SourceChange::from(edits))
|
Ok(SourceChange::from(edits))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ssr"
|
name = "ide_ssr"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
description = "Structural search and replace of Rust code"
|
description = "Structural search and replace of Rust code"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
|
@ -53,7 +53,7 @@ cfg = { path = "../cfg", version = "0.0.0" }
|
||||||
toolchain = { path = "../toolchain", version = "0.0.0" }
|
toolchain = { path = "../toolchain", version = "0.0.0" }
|
||||||
|
|
||||||
# This should only be used in CLI
|
# 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 = { path = "../hir", version = "0.0.0" }
|
||||||
hir_def = { path = "../hir_def", version = "0.0.0" }
|
hir_def = { path = "../hir_def", version = "0.0.0" }
|
||||||
hir_ty = { path = "../hir_ty", version = "0.0.0" }
|
hir_ty = { path = "../hir_ty", version = "0.0.0" }
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
use std::{env, path::PathBuf};
|
use std::{env, path::PathBuf};
|
||||||
|
|
||||||
use anyhow::{bail, format_err, Result};
|
use anyhow::{bail, format_err, Result};
|
||||||
|
use ide_ssr::{SsrPattern, SsrRule};
|
||||||
use pico_args::Arguments;
|
use pico_args::Arguments;
|
||||||
use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity};
|
use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity};
|
||||||
use ssr::{SsrPattern, SsrRule};
|
|
||||||
use vfs::AbsPathBuf;
|
use vfs::AbsPathBuf;
|
||||||
|
|
||||||
pub(crate) struct Args {
|
pub(crate) struct Args {
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::cli::{
|
||||||
load_cargo::{load_workspace_at, LoadCargoConfig},
|
load_cargo::{load_workspace_at, LoadCargoConfig},
|
||||||
Result,
|
Result,
|
||||||
};
|
};
|
||||||
use ssr::{MatchFinder, SsrPattern, SsrRule};
|
use ide_ssr::{MatchFinder, SsrPattern, SsrRule};
|
||||||
|
|
||||||
pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
|
pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
|
||||||
use ide_db::base_db::SourceDatabaseExt;
|
use ide_db::base_db::SourceDatabaseExt;
|
||||||
|
|
Loading…
Reference in a new issue