diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir/Cargo.toml (renamed from crates/ra_hir/Cargo.toml) | 11 | ||||
-rw-r--r-- | crates/hir/src/code_model.rs (renamed from crates/ra_hir/src/code_model.rs) | 0 | ||||
-rw-r--r-- | crates/hir/src/db.rs (renamed from crates/ra_hir/src/db.rs) | 0 | ||||
-rw-r--r-- | crates/hir/src/diagnostics.rs (renamed from crates/ra_hir/src/diagnostics.rs) | 0 | ||||
-rw-r--r-- | crates/hir/src/from_id.rs (renamed from crates/ra_hir/src/from_id.rs) | 0 | ||||
-rw-r--r-- | crates/hir/src/has_source.rs (renamed from crates/ra_hir/src/has_source.rs) | 0 | ||||
-rw-r--r-- | crates/hir/src/lib.rs (renamed from crates/ra_hir/src/lib.rs) | 4 | ||||
-rw-r--r-- | crates/hir/src/semantics.rs (renamed from crates/ra_hir/src/semantics.rs) | 0 | ||||
-rw-r--r-- | crates/hir/src/semantics/source_to_def.rs (renamed from crates/ra_hir/src/semantics/source_to_def.rs) | 0 | ||||
-rw-r--r-- | crates/hir/src/source_analyzer.rs (renamed from crates/ra_hir/src/source_analyzer.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/Cargo.toml (renamed from crates/ra_hir_ty/Cargo.toml) | 23 | ||||
-rw-r--r-- | crates/hir_ty/src/autoderef.rs (renamed from crates/ra_hir_ty/src/autoderef.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/db.rs (renamed from crates/ra_hir_ty/src/db.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/diagnostics.rs (renamed from crates/ra_hir_ty/src/diagnostics.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/diagnostics/expr.rs (renamed from crates/ra_hir_ty/src/diagnostics/expr.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/diagnostics/match_check.rs (renamed from crates/ra_hir_ty/src/diagnostics/match_check.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/diagnostics/unsafe_check.rs (renamed from crates/ra_hir_ty/src/diagnostics/unsafe_check.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/display.rs (renamed from crates/ra_hir_ty/src/display.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/infer.rs (renamed from crates/ra_hir_ty/src/infer.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/coerce.rs (renamed from crates/ra_hir_ty/src/infer/coerce.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs (renamed from crates/ra_hir_ty/src/infer/expr.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs (renamed from crates/ra_hir_ty/src/infer/pat.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/path.rs (renamed from crates/ra_hir_ty/src/infer/path.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs (renamed from crates/ra_hir_ty/src/infer/unify.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/lib.rs (renamed from crates/ra_hir_ty/src/lib.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/lower.rs (renamed from crates/ra_hir_ty/src/lower.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs (renamed from crates/ra_hir_ty/src/method_resolution.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/op.rs (renamed from crates/ra_hir_ty/src/op.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/primitive.rs (renamed from crates/ra_hir_ty/src/primitive.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/test_db.rs (renamed from crates/ra_hir_ty/src/test_db.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests.rs (renamed from crates/ra_hir_ty/src/tests.rs) | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/coercion.rs (renamed from crates/ra_hir_ty/src/tests/coercion.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/display_source_code.rs (renamed from crates/ra_hir_ty/src/tests/display_source_code.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/macros.rs (renamed from crates/ra_hir_ty/src/tests/macros.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/method_resolution.rs (renamed from crates/ra_hir_ty/src/tests/method_resolution.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/never_type.rs (renamed from crates/ra_hir_ty/src/tests/never_type.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/patterns.rs (renamed from crates/ra_hir_ty/src/tests/patterns.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs (renamed from crates/ra_hir_ty/src/tests/regression.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/simple.rs (renamed from crates/ra_hir_ty/src/tests/simple.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs (renamed from crates/ra_hir_ty/src/tests/traits.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/traits.rs (renamed from crates/ra_hir_ty/src/traits.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk.rs (renamed from crates/ra_hir_ty/src/traits/chalk.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/interner.rs (renamed from crates/ra_hir_ty/src/traits/chalk/interner.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs (renamed from crates/ra_hir_ty/src/traits/chalk/mapping.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/tls.rs (renamed from crates/ra_hir_ty/src/traits/chalk/tls.rs) | 0 | ||||
-rw-r--r-- | crates/hir_ty/src/utils.rs (renamed from crates/ra_hir_ty/src/utils.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/Cargo.toml (renamed from crates/ra_ide_db/Cargo.toml) | 12 | ||||
-rw-r--r-- | crates/ide_db/src/change.rs (renamed from crates/ra_ide_db/src/change.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/defs.rs (renamed from crates/ra_ide_db/src/defs.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/imports_locator.rs (renamed from crates/ra_ide_db/src/imports_locator.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/lib.rs (renamed from crates/ra_ide_db/src/lib.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/line_index.rs (renamed from crates/ra_ide_db/src/line_index.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/search.rs (renamed from crates/ra_ide_db/src/search.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/source_change.rs (renamed from crates/ra_ide_db/src/source_change.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/symbol_index.rs (renamed from crates/ra_ide_db/src/symbol_index.rs) | 0 | ||||
-rw-r--r-- | crates/ide_db/src/wasm_shims.rs (renamed from crates/ra_ide_db/src/wasm_shims.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/Cargo.toml | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/assist_context.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/add_turbo_fish.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/auto_import.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/expand_glob_import.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/fill_match_arms.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/inline_local_variable.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/reorder_fields.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/tests.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/utils.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/Cargo.toml | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/call_hierarchy.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/call_info.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/completion.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/diagnostics.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/expand_macro.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/extend_selection.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_implementation.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_type_definition.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/hover.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/lib.rs | 26 | ||||
-rw-r--r-- | crates/ra_ide/src/parent_module.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/references.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/references/rename.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/runnables.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/ssr.rs | 72 | ||||
-rw-r--r-- | crates/ra_ide/src/status.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_tree.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/typing.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/typing/on_enter.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 8 | ||||
-rw-r--r-- | crates/rust-analyzer/src/bin/args.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli.rs | 12 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/ssr.rs | 4 | ||||
-rw-r--r-- | crates/ssr/Cargo.toml (renamed from crates/ra_ssr/Cargo.toml) | 15 | ||||
-rw-r--r-- | crates/ssr/src/errors.rs (renamed from crates/ra_ssr/src/errors.rs) | 0 | ||||
-rw-r--r-- | crates/ssr/src/lib.rs (renamed from crates/ra_ssr/src/lib.rs) | 62 | ||||
-rw-r--r-- | crates/ssr/src/matching.rs (renamed from crates/ra_ssr/src/matching.rs) | 8 | ||||
-rw-r--r-- | crates/ssr/src/nester.rs (renamed from crates/ra_ssr/src/nester.rs) | 10 | ||||
-rw-r--r-- | crates/ssr/src/parsing.rs (renamed from crates/ra_ssr/src/parsing.rs) | 0 | ||||
-rw-r--r-- | crates/ssr/src/replacing.rs (renamed from crates/ra_ssr/src/replacing.rs) | 0 | ||||
-rw-r--r-- | crates/ssr/src/resolving.rs (renamed from crates/ra_ssr/src/resolving.rs) | 2 | ||||
-rw-r--r-- | crates/ssr/src/search.rs (renamed from crates/ra_ssr/src/search.rs) | 4 | ||||
-rw-r--r-- | crates/ssr/src/tests.rs (renamed from crates/ra_ssr/src/tests.rs) | 8 |
109 files changed, 173 insertions, 198 deletions
diff --git a/crates/ra_hir/Cargo.toml b/crates/hir/Cargo.toml index edca5dc6f..dbb2986b6 100644 --- a/crates/ra_hir/Cargo.toml +++ b/crates/hir/Cargo.toml | |||
@@ -1,9 +1,9 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "hir" |
3 | name = "ra_hir" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | 7 | ||
8 | [lib] | 8 | [lib] |
9 | doctest = false | 9 | doctest = false |
@@ -13,7 +13,6 @@ log = "0.4.8" | |||
13 | rustc-hash = "1.1.0" | 13 | rustc-hash = "1.1.0" |
14 | either = "1.5.3" | 14 | either = "1.5.3" |
15 | arrayvec = "0.5.1" | 15 | arrayvec = "0.5.1" |
16 | |||
17 | itertools = "0.9.0" | 16 | itertools = "0.9.0" |
18 | 17 | ||
19 | stdx = { path = "../stdx" } | 18 | stdx = { path = "../stdx" } |
@@ -22,4 +21,4 @@ base_db = { path = "../base_db" } | |||
22 | profile = { path = "../profile" } | 21 | profile = { path = "../profile" } |
23 | hir_expand = { path = "../hir_expand" } | 22 | hir_expand = { path = "../hir_expand" } |
24 | hir_def = { path = "../hir_def" } | 23 | hir_def = { path = "../hir_def" } |
25 | hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } | 24 | hir_ty = { path = "../hir_ty" } |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/hir/src/code_model.rs index 8ffb9e99b..8ffb9e99b 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
diff --git a/crates/ra_hir/src/db.rs b/crates/hir/src/db.rs index 07333c453..07333c453 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/hir/src/db.rs | |||
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs index 363164b9b..363164b9b 100644 --- a/crates/ra_hir/src/diagnostics.rs +++ b/crates/hir/src/diagnostics.rs | |||
diff --git a/crates/ra_hir/src/from_id.rs b/crates/hir/src/from_id.rs index a53ac1e08..a53ac1e08 100644 --- a/crates/ra_hir/src/from_id.rs +++ b/crates/hir/src/from_id.rs | |||
diff --git a/crates/ra_hir/src/has_source.rs b/crates/hir/src/has_source.rs index a50d4ff02..a50d4ff02 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs | |||
diff --git a/crates/ra_hir/src/lib.rs b/crates/hir/src/lib.rs index 34b02c536..24a0f6b4b 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -9,11 +9,11 @@ | |||
9 | //! It is written in "OO" style. Each type is self contained (as in, it knows it's | 9 | //! It is written in "OO" style. Each type is self contained (as in, it knows it's |
10 | //! parents and full context). It should be "clean code". | 10 | //! parents and full context). It should be "clean code". |
11 | //! | 11 | //! |
12 | //! `ra_hir_*` crates are the implementation of the compiler logic. | 12 | //! `hir_*` crates are the implementation of the compiler logic. |
13 | //! They are written in "ECS" style, with relatively little abstractions. | 13 | //! They are written in "ECS" style, with relatively little abstractions. |
14 | //! Many types are not self-contained, and explicitly use local indexes, arenas, etc. | 14 | //! Many types are not self-contained, and explicitly use local indexes, arenas, etc. |
15 | //! | 15 | //! |
16 | //! `ra_hir` is what insulates the "we don't know how to actually write an incremental compiler" | 16 | //! `hir` is what insulates the "we don't know how to actually write an incremental compiler" |
17 | //! from the ide with completions, hovers, etc. It is a (soft, internal) boundary: | 17 | //! from the ide with completions, hovers, etc. It is a (soft, internal) boundary: |
18 | //! https://www.tedinski.com/2018/02/06/system-boundaries.html. | 18 | //! https://www.tedinski.com/2018/02/06/system-boundaries.html. |
19 | 19 | ||
diff --git a/crates/ra_hir/src/semantics.rs b/crates/hir/src/semantics.rs index 1467d825d..1467d825d 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs | |||
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index 5918b9541..5918b9541 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs | |||
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index 8750584f9..8750584f9 100644 --- a/crates/ra_hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs | |||
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml index d430b08ca..83b5013a9 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/hir_ty/Cargo.toml | |||
@@ -1,9 +1,9 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "hir_ty" |
3 | name = "ra_hir_ty" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | 7 | ||
8 | [lib] | 8 | [lib] |
9 | doctest = false | 9 | doctest = false |
@@ -15,9 +15,12 @@ smallvec = "1.2.0" | |||
15 | ena = "0.14.0" | 15 | ena = "0.14.0" |
16 | log = "0.4.8" | 16 | log = "0.4.8" |
17 | rustc-hash = "1.1.0" | 17 | rustc-hash = "1.1.0" |
18 | scoped-tls = "1" | ||
19 | chalk-solve = { version = "0.21.0" } | ||
20 | chalk-ir = { version = "0.21.0" } | ||
21 | chalk-recursive = { version = "0.21.0" } | ||
18 | 22 | ||
19 | stdx = { path = "../stdx" } | 23 | stdx = { path = "../stdx" } |
20 | |||
21 | hir_def = { path = "../hir_def" } | 24 | hir_def = { path = "../hir_def" } |
22 | hir_expand = { path = "../hir_expand" } | 25 | hir_expand = { path = "../hir_expand" } |
23 | arena = { path = "../arena" } | 26 | arena = { path = "../arena" } |
@@ -26,15 +29,9 @@ profile = { path = "../profile" } | |||
26 | syntax = { path = "../syntax" } | 29 | syntax = { path = "../syntax" } |
27 | test_utils = { path = "../test_utils" } | 30 | test_utils = { path = "../test_utils" } |
28 | 31 | ||
29 | scoped-tls = "1" | ||
30 | |||
31 | chalk-solve = { version = "0.21.0" } | ||
32 | chalk-ir = { version = "0.21.0" } | ||
33 | chalk-recursive = { version = "0.21.0" } | ||
34 | |||
35 | [dev-dependencies] | 32 | [dev-dependencies] |
36 | expect = { path = "../expect" } | ||
37 | |||
38 | tracing = "0.1" | 33 | tracing = "0.1" |
39 | tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry"] } | 34 | tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry"] } |
40 | tracing-tree = { version = "0.1.4" } | 35 | tracing-tree = { version = "0.1.4" } |
36 | |||
37 | expect = { path = "../expect" } | ||
diff --git a/crates/ra_hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs index ece68183e..ece68183e 100644 --- a/crates/ra_hir_ty/src/autoderef.rs +++ b/crates/hir_ty/src/autoderef.rs | |||
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/hir_ty/src/db.rs index 25cf9eb7f..25cf9eb7f 100644 --- a/crates/ra_hir_ty/src/db.rs +++ b/crates/hir_ty/src/db.rs | |||
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs index ae0cf8d09..ae0cf8d09 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/hir_ty/src/diagnostics.rs | |||
diff --git a/crates/ra_hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs index fb76e2e4e..fb76e2e4e 100644 --- a/crates/ra_hir_ty/src/diagnostics/expr.rs +++ b/crates/hir_ty/src/diagnostics/expr.rs | |||
diff --git a/crates/ra_hir_ty/src/diagnostics/match_check.rs b/crates/hir_ty/src/diagnostics/match_check.rs index 7f007f1d6..7f007f1d6 100644 --- a/crates/ra_hir_ty/src/diagnostics/match_check.rs +++ b/crates/hir_ty/src/diagnostics/match_check.rs | |||
diff --git a/crates/ra_hir_ty/src/diagnostics/unsafe_check.rs b/crates/hir_ty/src/diagnostics/unsafe_check.rs index 61ffbf5d1..61ffbf5d1 100644 --- a/crates/ra_hir_ty/src/diagnostics/unsafe_check.rs +++ b/crates/hir_ty/src/diagnostics/unsafe_check.rs | |||
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 19770e609..19770e609 100644 --- a/crates/ra_hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index 03b00b101..03b00b101 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs | |||
diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index 32c7c57cd..32c7c57cd 100644 --- a/crates/ra_hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs | |||
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index a2f849d02..a2f849d02 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 4dd4f9802..4dd4f9802 100644 --- a/crates/ra_hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
diff --git a/crates/ra_hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index 80d7ed10e..80d7ed10e 100644 --- a/crates/ra_hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs | |||
diff --git a/crates/ra_hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 2e895d911..2e895d911 100644 --- a/crates/ra_hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 1e748476a..1e748476a 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index cd574e983..cd574e983 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index ec59145c7..ec59145c7 100644 --- a/crates/ra_hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
diff --git a/crates/ra_hir_ty/src/op.rs b/crates/hir_ty/src/op.rs index 0870874fc..0870874fc 100644 --- a/crates/ra_hir_ty/src/op.rs +++ b/crates/hir_ty/src/op.rs | |||
diff --git a/crates/ra_hir_ty/src/primitive.rs b/crates/hir_ty/src/primitive.rs index 37966b709..37966b709 100644 --- a/crates/ra_hir_ty/src/primitive.rs +++ b/crates/hir_ty/src/primitive.rs | |||
diff --git a/crates/ra_hir_ty/src/test_db.rs b/crates/hir_ty/src/test_db.rs index 15b8435e9..15b8435e9 100644 --- a/crates/ra_hir_ty/src/test_db.rs +++ b/crates/hir_ty/src/test_db.rs | |||
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs index f6b172c3a..c953925ec 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/hir_ty/src/tests.rs | |||
@@ -35,7 +35,7 @@ use crate::{ | |||
35 | 35 | ||
36 | // These tests compare the inference results for all expressions in a file | 36 | // These tests compare the inference results for all expressions in a file |
37 | // against snapshots of the expected results using expect. Use | 37 | // against snapshots of the expected results using expect. Use |
38 | // `env UPDATE_EXPECT=1 cargo test -p ra_hir_ty` to update the snapshots. | 38 | // `env UPDATE_EXPECT=1 cargo test -p hir_ty` to update the snapshots. |
39 | 39 | ||
40 | fn setup_tracing() -> tracing::subscriber::DefaultGuard { | 40 | fn setup_tracing() -> tracing::subscriber::DefaultGuard { |
41 | use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; | 41 | use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; |
diff --git a/crates/ra_hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs index 17efd75cb..17efd75cb 100644 --- a/crates/ra_hir_ty/src/tests/coercion.rs +++ b/crates/hir_ty/src/tests/coercion.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/display_source_code.rs b/crates/hir_ty/src/tests/display_source_code.rs index b502135d8..b502135d8 100644 --- a/crates/ra_hir_ty/src/tests/display_source_code.rs +++ b/crates/hir_ty/src/tests/display_source_code.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs index d887c7a79..d887c7a79 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/hir_ty/src/tests/macros.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs index fa68355aa..fa68355aa 100644 --- a/crates/ra_hir_ty/src/tests/method_resolution.rs +++ b/crates/hir_ty/src/tests/method_resolution.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/never_type.rs b/crates/hir_ty/src/tests/never_type.rs index 49538b572..49538b572 100644 --- a/crates/ra_hir_ty/src/tests/never_type.rs +++ b/crates/hir_ty/src/tests/never_type.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index 39fabf7eb..39fabf7eb 100644 --- a/crates/ra_hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index b9ab0f357..b9ab0f357 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs index 59eb59d5f..59eb59d5f 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/hir_ty/src/tests/simple.rs | |||
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 526e61caf..526e61caf 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/hir_ty/src/traits.rs index 255323717..255323717 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/hir_ty/src/traits.rs | |||
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index b33653417..b33653417 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs | |||
diff --git a/crates/ra_hir_ty/src/traits/chalk/interner.rs b/crates/hir_ty/src/traits/chalk/interner.rs index fc0f9c201..fc0f9c201 100644 --- a/crates/ra_hir_ty/src/traits/chalk/interner.rs +++ b/crates/hir_ty/src/traits/chalk/interner.rs | |||
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index fe62f3fa7..fe62f3fa7 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/hir_ty/src/traits/chalk/tls.rs index db915625c..db915625c 100644 --- a/crates/ra_hir_ty/src/traits/chalk/tls.rs +++ b/crates/hir_ty/src/traits/chalk/tls.rs | |||
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index e3e244268..e3e244268 100644 --- a/crates/ra_hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs | |||
diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ide_db/Cargo.toml index 0cda7090d..885212162 100644 --- a/crates/ra_ide_db/Cargo.toml +++ b/crates/ide_db/Cargo.toml | |||
@@ -1,9 +1,9 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "ide_db" |
3 | name = "ra_ide_db" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | 7 | ||
8 | [lib] | 8 | [lib] |
9 | doctest = false | 9 | doctest = false |
@@ -20,13 +20,11 @@ once_cell = "1.3.1" | |||
20 | either = "1.5.3" | 20 | either = "1.5.3" |
21 | 21 | ||
22 | stdx = { path = "../stdx" } | 22 | stdx = { path = "../stdx" } |
23 | |||
24 | syntax = { path = "../syntax" } | 23 | syntax = { path = "../syntax" } |
25 | text_edit = { path = "../text_edit" } | 24 | text_edit = { path = "../text_edit" } |
26 | base_db = { path = "../base_db" } | 25 | base_db = { path = "../base_db" } |
27 | profile = { path = "../profile" } | 26 | profile = { path = "../profile" } |
28 | test_utils = { path = "../test_utils" } | 27 | test_utils = { path = "../test_utils" } |
29 | |||
30 | # ra_ide should depend only on the top-level `hir` package. if you need | 28 | # ra_ide should depend only on the top-level `hir` package. if you need |
31 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | 29 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. |
32 | hir = { path = "../ra_hir", package = "ra_hir" } | 30 | hir = { path = "../hir" } |
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ide_db/src/change.rs index 8b4fd7ab8..8b4fd7ab8 100644 --- a/crates/ra_ide_db/src/change.rs +++ b/crates/ide_db/src/change.rs | |||
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index 7b5d6ac49..7b5d6ac49 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
diff --git a/crates/ra_ide_db/src/imports_locator.rs b/crates/ide_db/src/imports_locator.rs index 1d0c20291..1d0c20291 100644 --- a/crates/ra_ide_db/src/imports_locator.rs +++ b/crates/ide_db/src/imports_locator.rs | |||
diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index fd474cd0f..fd474cd0f 100644 --- a/crates/ra_ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs | |||
diff --git a/crates/ra_ide_db/src/line_index.rs b/crates/ide_db/src/line_index.rs index a381f7fb8..a381f7fb8 100644 --- a/crates/ra_ide_db/src/line_index.rs +++ b/crates/ide_db/src/line_index.rs | |||
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ide_db/src/search.rs index b9360bf12..b9360bf12 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs | |||
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ide_db/src/source_change.rs index f1590ec66..f1590ec66 100644 --- a/crates/ra_ide_db/src/source_change.rs +++ b/crates/ide_db/src/source_change.rs | |||
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ide_db/src/symbol_index.rs index 654df898e..654df898e 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ide_db/src/symbol_index.rs | |||
diff --git a/crates/ra_ide_db/src/wasm_shims.rs b/crates/ide_db/src/wasm_shims.rs index 7af9f9d9b..7af9f9d9b 100644 --- a/crates/ra_ide_db/src/wasm_shims.rs +++ b/crates/ide_db/src/wasm_shims.rs | |||
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml index ebac09be6..19e7591f7 100644 --- a/crates/ra_assists/Cargo.toml +++ b/crates/ra_assists/Cargo.toml | |||
@@ -19,6 +19,6 @@ syntax = { path = "../syntax" } | |||
19 | text_edit = { path = "../text_edit" } | 19 | text_edit = { path = "../text_edit" } |
20 | profile = { path = "../profile" } | 20 | profile = { path = "../profile" } |
21 | base_db = { path = "../base_db" } | 21 | base_db = { path = "../base_db" } |
22 | ra_ide_db = { path = "../ra_ide_db" } | 22 | ide_db = { path = "../ide_db" } |
23 | hir = { path = "../ra_hir", package = "ra_hir" } | 23 | hir = { path = "../hir" } |
24 | test_utils = { path = "../test_utils" } | 24 | test_utils = { path = "../test_utils" } |
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs index 2fdce037f..79574b9ac 100644 --- a/crates/ra_assists/src/assist_context.rs +++ b/crates/ra_assists/src/assist_context.rs | |||
@@ -5,7 +5,7 @@ use std::mem; | |||
5 | use algo::find_covering_element; | 5 | use algo::find_covering_element; |
6 | use base_db::{FileId, FileRange}; | 6 | use base_db::{FileId, FileRange}; |
7 | use hir::Semantics; | 7 | use hir::Semantics; |
8 | use ra_ide_db::{ | 8 | use ide_db::{ |
9 | source_change::{SourceChange, SourceFileEdit}, | 9 | source_change::{SourceChange, SourceFileEdit}, |
10 | RootDatabase, | 10 | RootDatabase, |
11 | }; | 11 | }; |
diff --git a/crates/ra_assists/src/handlers/add_turbo_fish.rs b/crates/ra_assists/src/handlers/add_turbo_fish.rs index 8c7ffae3d..f4f997d8e 100644 --- a/crates/ra_assists/src/handlers/add_turbo_fish.rs +++ b/crates/ra_assists/src/handlers/add_turbo_fish.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass}; | 1 | use ide_db::defs::{classify_name_ref, Definition, NameRefClass}; |
2 | use syntax::{ast, AstNode, SyntaxKind, T}; | 2 | use syntax::{ast, AstNode, SyntaxKind, T}; |
3 | use test_utils::mark; | 3 | use test_utils::mark; |
4 | 4 | ||
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index e19b197d9..cce789972 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -5,7 +5,7 @@ use hir::{ | |||
5 | AsAssocItem, AssocItemContainer, ModPath, Module, ModuleDef, PathResolution, Semantics, Trait, | 5 | AsAssocItem, AssocItemContainer, ModPath, Module, ModuleDef, PathResolution, Semantics, Trait, |
6 | Type, | 6 | Type, |
7 | }; | 7 | }; |
8 | use ra_ide_db::{imports_locator, RootDatabase}; | 8 | use ide_db::{imports_locator, RootDatabase}; |
9 | use rustc_hash::FxHashSet; | 9 | use rustc_hash::FxHashSet; |
10 | use syntax::{ | 10 | use syntax::{ |
11 | ast::{self, AstNode}, | 11 | ast::{self, AstNode}, |
diff --git a/crates/ra_assists/src/handlers/expand_glob_import.rs b/crates/ra_assists/src/handlers/expand_glob_import.rs index cf34ffaf7..f690ec343 100644 --- a/crates/ra_assists/src/handlers/expand_glob_import.rs +++ b/crates/ra_assists/src/handlers/expand_glob_import.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::{AssocItem, MacroDef, ModuleDef, Name, PathResolution, ScopeDef, SemanticsScope}; | 1 | use hir::{AssocItem, MacroDef, ModuleDef, Name, PathResolution, ScopeDef, SemanticsScope}; |
2 | use ra_ide_db::{ | 2 | use ide_db::{ |
3 | defs::{classify_name_ref, Definition, NameRefClass}, | 3 | defs::{classify_name_ref, Definition, NameRefClass}, |
4 | RootDatabase, | 4 | RootDatabase, |
5 | }; | 5 | }; |
diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs index 52fbc540e..4bcdae7ba 100644 --- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use base_db::FileId; | 1 | use base_db::FileId; |
2 | use hir::{EnumVariant, Module, ModuleDef, Name}; | 2 | use hir::{EnumVariant, Module, ModuleDef, Name}; |
3 | use ra_ide_db::{defs::Definition, search::Reference, RootDatabase}; | 3 | use ide_db::{defs::Definition, search::Reference, RootDatabase}; |
4 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
5 | use syntax::{ | 5 | use syntax::{ |
6 | algo::find_node_at_offset, | 6 | algo::find_node_at_offset, |
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs index 8f6660637..3d9bdb2bf 100644 --- a/crates/ra_assists/src/handlers/fill_match_arms.rs +++ b/crates/ra_assists/src/handlers/fill_match_arms.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use std::iter; | 1 | use std::iter; |
2 | 2 | ||
3 | use hir::{Adt, HasSource, ModuleDef, Semantics}; | 3 | use hir::{Adt, HasSource, ModuleDef, Semantics}; |
4 | use ide_db::RootDatabase; | ||
4 | use itertools::Itertools; | 5 | use itertools::Itertools; |
5 | use ra_ide_db::RootDatabase; | ||
6 | use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; | 6 | use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; |
7 | use test_utils::mark; | 7 | use test_utils::mark; |
8 | 8 | ||
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs index 302b6b67d..7f04b9572 100644 --- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::RootDatabase; | 1 | use ide_db::RootDatabase; |
2 | use syntax::ast::{self, AstNode, NameOwner}; | 2 | use syntax::ast::{self, AstNode, NameOwner}; |
3 | use test_utils::mark; | 3 | use test_utils::mark; |
4 | 4 | ||
diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs index 531592320..2b52b333b 100644 --- a/crates/ra_assists/src/handlers/inline_local_variable.rs +++ b/crates/ra_assists/src/handlers/inline_local_variable.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::defs::Definition; | 1 | use ide_db::defs::Definition; |
2 | use syntax::{ | 2 | use syntax::{ |
3 | ast::{self, AstNode, AstToken}, | 3 | ast::{self, AstNode, AstToken}, |
4 | TextRange, | 4 | TextRange, |
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index 013720dfc..527f457a7 100644 --- a/crates/ra_assists/src/handlers/reorder_fields.rs +++ b/crates/ra_assists/src/handlers/reorder_fields.rs | |||
@@ -2,7 +2,7 @@ use itertools::Itertools; | |||
2 | use rustc_hash::FxHashMap; | 2 | use rustc_hash::FxHashMap; |
3 | 3 | ||
4 | use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; | 4 | use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; | 6 | use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; |
7 | 7 | ||
8 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 8 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 5d062b88b..f0cf35caf 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -19,7 +19,7 @@ pub mod ast_transform; | |||
19 | 19 | ||
20 | use base_db::FileRange; | 20 | use base_db::FileRange; |
21 | use hir::Semantics; | 21 | use hir::Semantics; |
22 | use ra_ide_db::{source_change::SourceChange, RootDatabase}; | 22 | use ide_db::{source_change::SourceChange, RootDatabase}; |
23 | use syntax::TextRange; | 23 | use syntax::TextRange; |
24 | 24 | ||
25 | pub(crate) use crate::assist_context::{AssistContext, Assists}; | 25 | pub(crate) use crate::assist_context::{AssistContext, Assists}; |
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs index 75d973688..ba1fb543b 100644 --- a/crates/ra_assists/src/tests.rs +++ b/crates/ra_assists/src/tests.rs | |||
@@ -2,7 +2,7 @@ mod generated; | |||
2 | 2 | ||
3 | use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; | 3 | use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; |
4 | use hir::Semantics; | 4 | use hir::Semantics; |
5 | use ra_ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::TextRange; | 6 | use syntax::TextRange; |
7 | use test_utils::{assert_eq_text, extract_offset, extract_range}; | 7 | use test_utils::{assert_eq_text, extract_offset, extract_range}; |
8 | 8 | ||
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index a20453dd8..84ccacafe 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -4,8 +4,8 @@ pub(crate) mod insert_use; | |||
4 | use std::{iter, ops}; | 4 | use std::{iter, ops}; |
5 | 5 | ||
6 | use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type}; | 6 | use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type}; |
7 | use ide_db::RootDatabase; | ||
7 | use itertools::Itertools; | 8 | use itertools::Itertools; |
8 | use ra_ide_db::RootDatabase; | ||
9 | use rustc_hash::FxHashSet; | 9 | use rustc_hash::FxHashSet; |
10 | use syntax::{ | 10 | use syntax::{ |
11 | ast::{self, make, NameOwner}, | 11 | ast::{self, make, NameOwner}, |
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index 1af51f3ae..8519e9cca 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml | |||
@@ -24,16 +24,16 @@ stdx = { path = "../stdx" } | |||
24 | syntax = { path = "../syntax" } | 24 | syntax = { path = "../syntax" } |
25 | text_edit = { path = "../text_edit" } | 25 | text_edit = { path = "../text_edit" } |
26 | base_db = { path = "../base_db" } | 26 | base_db = { path = "../base_db" } |
27 | ra_ide_db = { path = "../ra_ide_db" } | 27 | ide_db = { path = "../ide_db" } |
28 | cfg = { path = "../cfg" } | 28 | cfg = { path = "../cfg" } |
29 | profile = { path = "../profile" } | 29 | profile = { path = "../profile" } |
30 | test_utils = { path = "../test_utils" } | 30 | test_utils = { path = "../test_utils" } |
31 | ra_assists = { path = "../ra_assists" } | 31 | ra_assists = { path = "../ra_assists" } |
32 | ra_ssr = { path = "../ra_ssr" } | 32 | ssr = { path = "../ssr" } |
33 | 33 | ||
34 | # ra_ide should depend only on the top-level `hir` package. if you need | 34 | # ra_ide should depend only on the top-level `hir` package. if you need |
35 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | 35 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. |
36 | hir = { path = "../ra_hir", package = "ra_hir" } | 36 | hir = { path = "../hir" } |
37 | 37 | ||
38 | [dev-dependencies] | 38 | [dev-dependencies] |
39 | expect = { path = "../expect" } | 39 | expect = { path = "../expect" } |
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index 3578b8d3c..58e26b94c 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use indexmap::IndexMap; | 3 | use indexmap::IndexMap; |
4 | 4 | ||
5 | use hir::Semantics; | 5 | use hir::Semantics; |
6 | use ra_ide_db::RootDatabase; | 6 | use ide_db::RootDatabase; |
7 | use syntax::{ast, match_ast, AstNode, TextRange}; | 7 | use syntax::{ast, match_ast, AstNode, TextRange}; |
8 | 8 | ||
9 | use crate::{ | 9 | use crate::{ |
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs index 703cbc6b4..86abd2d8c 100644 --- a/crates/ra_ide/src/call_info.rs +++ b/crates/ra_ide/src/call_info.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | use either::Either; | 2 | use either::Either; |
3 | use hir::{Docs, HirDisplay, Semantics, Type}; | 3 | use hir::{Docs, HirDisplay, Semantics, Type}; |
4 | use ra_ide_db::RootDatabase; | 4 | use ide_db::RootDatabase; |
5 | use stdx::format_to; | 5 | use stdx::format_to; |
6 | use syntax::{ | 6 | use syntax::{ |
7 | ast::{self, ArgListOwner}, | 7 | ast::{self, ArgListOwner}, |
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index 68ac05e4c..7fb4d687e 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs | |||
@@ -19,7 +19,7 @@ mod complete_postfix; | |||
19 | mod complete_macro_in_item_position; | 19 | mod complete_macro_in_item_position; |
20 | mod complete_trait_impl; | 20 | mod complete_trait_impl; |
21 | 21 | ||
22 | use ra_ide_db::RootDatabase; | 22 | use ide_db::RootDatabase; |
23 | 23 | ||
24 | use crate::{ | 24 | use crate::{ |
25 | completion::{ | 25 | completion::{ |
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 0e0a201d0..047ecd9d7 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use base_db::SourceDatabase; | 3 | use base_db::SourceDatabase; |
4 | use hir::{Semantics, SemanticsScope, Type}; | 4 | use hir::{Semantics, SemanticsScope, Type}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{ | 6 | use syntax::{ |
7 | algo::{find_covering_element, find_node_at_offset}, | 7 | algo::{find_covering_element, find_node_at_offset}, |
8 | ast, match_ast, AstNode, NodeOrToken, | 8 | ast, match_ast, AstNode, NodeOrToken, |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 4e59e3a48..a3ec98178 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -8,8 +8,8 @@ use std::cell::RefCell; | |||
8 | 8 | ||
9 | use base_db::SourceDatabase; | 9 | use base_db::SourceDatabase; |
10 | use hir::{diagnostics::DiagnosticSinkBuilder, Semantics}; | 10 | use hir::{diagnostics::DiagnosticSinkBuilder, Semantics}; |
11 | use ide_db::RootDatabase; | ||
11 | use itertools::Itertools; | 12 | use itertools::Itertools; |
12 | use ra_ide_db::RootDatabase; | ||
13 | use syntax::{ | 13 | use syntax::{ |
14 | ast::{self, AstNode}, | 14 | ast::{self, AstNode}, |
15 | SyntaxNode, TextRange, T, | 15 | SyntaxNode, TextRange, T, |
diff --git a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs index 7e126d7a6..85b46c995 100644 --- a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs +++ b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs | |||
@@ -8,7 +8,7 @@ use hir::{ | |||
8 | diagnostics::{Diagnostic, MissingFields, MissingOkInTailExpr, NoSuchField, UnresolvedModule}, | 8 | diagnostics::{Diagnostic, MissingFields, MissingOkInTailExpr, NoSuchField, UnresolvedModule}, |
9 | HasSource, HirDisplay, Semantics, VariantDef, | 9 | HasSource, HirDisplay, Semantics, VariantDef, |
10 | }; | 10 | }; |
11 | use ra_ide_db::{ | 11 | use ide_db::{ |
12 | source_change::{FileSystemEdit, SourceFileEdit}, | 12 | source_change::{FileSystemEdit, SourceFileEdit}, |
13 | RootDatabase, | 13 | RootDatabase, |
14 | }; | 14 | }; |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 09ec3f65e..e77106177 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use base_db::{FileId, SourceDatabase}; | 3 | use base_db::{FileId, SourceDatabase}; |
4 | use either::Either; | 4 | use either::Either; |
5 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; | 5 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; |
6 | use ra_ide_db::{defs::Definition, RootDatabase}; | 6 | use ide_db::{defs::Definition, RootDatabase}; |
7 | use syntax::{ | 7 | use syntax::{ |
8 | ast::{self, DocCommentsOwner, NameOwner}, | 8 | ast::{self, DocCommentsOwner, NameOwner}, |
9 | match_ast, AstNode, SmolStr, | 9 | match_ast, AstNode, SmolStr, |
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs index c25e068d6..31455709d 100644 --- a/crates/ra_ide/src/expand_macro.rs +++ b/crates/ra_ide/src/expand_macro.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::Semantics; | 1 | use hir::Semantics; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::{ | 3 | use syntax::{ |
4 | algo::{find_node_at_offset, SyntaxRewriter}, | 4 | algo::{find_node_at_offset, SyntaxRewriter}, |
5 | ast, AstNode, NodeOrToken, SyntaxKind, | 5 | ast, AstNode, NodeOrToken, SyntaxKind, |
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index f30df2bff..34563a026 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::iter::successors; | 1 | use std::iter::successors; |
2 | 2 | ||
3 | use hir::Semantics; | 3 | use hir::Semantics; |
4 | use ra_ide_db::RootDatabase; | 4 | use ide_db::RootDatabase; |
5 | use syntax::{ | 5 | use syntax::{ |
6 | algo::{self, find_covering_element, skip_trivia_token}, | 6 | algo::{self, find_covering_element, skip_trivia_token}, |
7 | ast::{self, AstNode, AstToken}, | 7 | ast::{self, AstNode, AstToken}, |
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index b93d116bf..15e9b7fad 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::Semantics; | 1 | use hir::Semantics; |
2 | use ra_ide_db::{ | 2 | use ide_db::{ |
3 | defs::{classify_name, classify_name_ref}, | 3 | defs::{classify_name, classify_name_ref}, |
4 | symbol_index, RootDatabase, | 4 | symbol_index, RootDatabase, |
5 | }; | 5 | }; |
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index 6dc2ccfd0..f503f4ec5 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::{Crate, ImplDef, Semantics}; | 1 | use hir::{Crate, ImplDef, Semantics}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::{algo::find_node_at_offset, ast, AstNode}; | 3 | use syntax::{algo::find_node_at_offset, ast, AstNode}; |
4 | 4 | ||
5 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; | 5 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; |
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs index 8017ca58c..4a151b150 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::RootDatabase; | 1 | use ide_db::RootDatabase; |
2 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; | 2 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; |
3 | 3 | ||
4 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; | 4 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index a74087f87..331aa4db0 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -3,11 +3,11 @@ use hir::{ | |||
3 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, | 3 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, |
4 | Module, ModuleDef, ModuleSource, Semantics, | 4 | Module, ModuleDef, ModuleSource, Semantics, |
5 | }; | 5 | }; |
6 | use itertools::Itertools; | 6 | use ide_db::{ |
7 | use ra_ide_db::{ | ||
8 | defs::{classify_name, classify_name_ref, Definition}, | 7 | defs::{classify_name, classify_name_ref, Definition}, |
9 | RootDatabase, | 8 | RootDatabase, |
10 | }; | 9 | }; |
10 | use itertools::Itertools; | ||
11 | use stdx::format_to; | 11 | use stdx::format_to; |
12 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; | 12 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; |
13 | use test_utils::mark; | 13 | use test_utils::mark; |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 81fe274ad..002adf915 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::{Adt, Callable, HirDisplay, Semantics, Type}; | 1 | use hir::{Adt, Callable, HirDisplay, Semantics, Type}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use stdx::to_lower_snake_case; | 3 | use stdx::to_lower_snake_case; |
4 | use syntax::{ | 4 | use syntax::{ |
5 | ast::{self, ArgListOwner, AstNode}, | 5 | ast::{self, ArgListOwner, AstNode}, |
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 789fbdaf2..bbc9e4b8a 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | //! Strings, suitable for displaying to the human. | 3 | //! Strings, suitable for displaying to the human. |
4 | //! | 4 | //! |
5 | //! What powers this API are the `RootDatabase` struct, which defines a `salsa` | 5 | //! What powers this API are the `RootDatabase` struct, which defines a `salsa` |
6 | //! database, and the `ra_hir` crate, where majority of the analysis happens. | 6 | //! database, and the `hir` crate, where majority of the analysis happens. |
7 | //! However, IDE specific bits of the analysis (most notably completion) happen | 7 | //! However, IDE specific bits of the analysis (most notably completion) happen |
8 | //! in this crate. | 8 | //! in this crate. |
9 | 9 | ||
@@ -39,7 +39,6 @@ mod matching_brace; | |||
39 | mod parent_module; | 39 | mod parent_module; |
40 | mod references; | 40 | mod references; |
41 | mod runnables; | 41 | mod runnables; |
42 | mod ssr; | ||
43 | mod status; | 42 | mod status; |
44 | mod syntax_highlighting; | 43 | mod syntax_highlighting; |
45 | mod syntax_tree; | 44 | mod syntax_tree; |
@@ -52,7 +51,7 @@ use base_db::{ | |||
52 | CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, | 51 | CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, |
53 | }; | 52 | }; |
54 | use cfg::CfgOptions; | 53 | use cfg::CfgOptions; |
55 | use ra_ide_db::{ | 54 | use ide_db::{ |
56 | symbol_index::{self, FileSymbol}, | 55 | symbol_index::{self, FileSymbol}, |
57 | LineIndexDatabase, | 56 | LineIndexDatabase, |
58 | }; | 57 | }; |
@@ -86,8 +85,7 @@ pub use base_db::{ | |||
86 | SourceRootId, | 85 | SourceRootId, |
87 | }; | 86 | }; |
88 | pub use hir::{Documentation, Semantics}; | 87 | pub use hir::{Documentation, Semantics}; |
89 | pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; | 88 | pub use ide_db::{ |
90 | pub use ra_ide_db::{ | ||
91 | change::AnalysisChange, | 89 | change::AnalysisChange, |
92 | line_index::{LineCol, LineIndex}, | 90 | line_index::{LineCol, LineIndex}, |
93 | search::SearchScope, | 91 | search::SearchScope, |
@@ -95,7 +93,8 @@ pub use ra_ide_db::{ | |||
95 | symbol_index::Query, | 93 | symbol_index::Query, |
96 | RootDatabase, | 94 | RootDatabase, |
97 | }; | 95 | }; |
98 | pub use ra_ssr::SsrError; | 96 | pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; |
97 | pub use ssr::SsrError; | ||
99 | pub use text_edit::{Indel, TextEdit}; | 98 | pub use text_edit::{Indel, TextEdit}; |
100 | 99 | ||
101 | pub type Cancelable<T> = Result<T, Canceled>; | 100 | pub type Cancelable<T> = Result<T, Canceled>; |
@@ -515,20 +514,23 @@ impl Analysis { | |||
515 | &self, | 514 | &self, |
516 | query: &str, | 515 | query: &str, |
517 | parse_only: bool, | 516 | parse_only: bool, |
518 | position: FilePosition, | 517 | resolve_context: FilePosition, |
519 | selections: Vec<FileRange>, | 518 | selections: Vec<FileRange>, |
520 | ) -> Cancelable<Result<SourceChange, SsrError>> { | 519 | ) -> Cancelable<Result<SourceChange, SsrError>> { |
521 | self.with_db(|db| { | 520 | self.with_db(|db| { |
522 | let edits = ssr::parse_search_replace(query, parse_only, db, position, selections)?; | 521 | let rule: ssr::SsrRule = query.parse()?; |
522 | let mut match_finder = ssr::MatchFinder::in_context(db, resolve_context, selections); | ||
523 | match_finder.add_rule(rule)?; | ||
524 | let edits = if parse_only { Vec::new() } else { match_finder.edits() }; | ||
523 | Ok(SourceChange::from(edits)) | 525 | Ok(SourceChange::from(edits)) |
524 | }) | 526 | }) |
525 | } | 527 | } |
526 | 528 | ||
527 | /// Performs an operation on that may be Canceled. | 529 | /// Performs an operation on that may be Canceled. |
528 | fn with_db<F: FnOnce(&RootDatabase) -> T + std::panic::UnwindSafe, T>( | 530 | fn with_db<F, T>(&self, f: F) -> Cancelable<T> |
529 | &self, | 531 | where |
530 | f: F, | 532 | F: FnOnce(&RootDatabase) -> T + std::panic::UnwindSafe, |
531 | ) -> Cancelable<T> { | 533 | { |
532 | self.db.catch_canceled(f) | 534 | self.db.catch_canceled(f) |
533 | } | 535 | } |
534 | } | 536 | } |
diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs index 8439e1d5d..59ed2967c 100644 --- a/crates/ra_ide/src/parent_module.rs +++ b/crates/ra_ide/src/parent_module.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use base_db::{CrateId, FileId, FilePosition}; | 1 | use base_db::{CrateId, FileId, FilePosition}; |
2 | use hir::Semantics; | 2 | use hir::Semantics; |
3 | use ra_ide_db::RootDatabase; | 3 | use ide_db::RootDatabase; |
4 | use syntax::{ | 4 | use syntax::{ |
5 | algo::find_node_at_offset, | 5 | algo::find_node_at_offset, |
6 | ast::{self, AstNode}, | 6 | ast::{self, AstNode}, |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index e89dca869..0a76ec6b4 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -12,7 +12,7 @@ | |||
12 | mod rename; | 12 | mod rename; |
13 | 13 | ||
14 | use hir::Semantics; | 14 | use hir::Semantics; |
15 | use ra_ide_db::{ | 15 | use ide_db::{ |
16 | defs::{classify_name, classify_name_ref, Definition}, | 16 | defs::{classify_name, classify_name_ref, Definition}, |
17 | search::SearchScope, | 17 | search::SearchScope, |
18 | RootDatabase, | 18 | RootDatabase, |
@@ -27,7 +27,7 @@ use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeI | |||
27 | 27 | ||
28 | pub(crate) use self::rename::rename; | 28 | pub(crate) use self::rename::rename; |
29 | 29 | ||
30 | pub use ra_ide_db::search::{Reference, ReferenceAccess, ReferenceKind}; | 30 | pub use ide_db::search::{Reference, ReferenceAccess, ReferenceKind}; |
31 | 31 | ||
32 | #[derive(Debug, Clone)] | 32 | #[derive(Debug, Clone)] |
33 | pub struct ReferenceSearchResult { | 33 | pub struct ReferenceSearchResult { |
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 5697b9d87..d73dc9cd0 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use base_db::SourceDatabaseExt; | 3 | use base_db::SourceDatabaseExt; |
4 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; | 4 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; |
5 | use ra_ide_db::{ | 5 | use ide_db::{ |
6 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 6 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, |
7 | RootDatabase, | 7 | RootDatabase, |
8 | }; | 8 | }; |
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index fb40762cf..c3e07c8de 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs | |||
@@ -2,8 +2,8 @@ use std::fmt; | |||
2 | 2 | ||
3 | use cfg::CfgExpr; | 3 | use cfg::CfgExpr; |
4 | use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics}; | 4 | use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics}; |
5 | use ide_db::RootDatabase; | ||
5 | use itertools::Itertools; | 6 | use itertools::Itertools; |
6 | use ra_ide_db::RootDatabase; | ||
7 | use syntax::{ | 7 | use syntax::{ |
8 | ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner}, | 8 | ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner}, |
9 | match_ast, SyntaxNode, | 9 | match_ast, SyntaxNode, |
diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs deleted file mode 100644 index 97b82b70e..000000000 --- a/crates/ra_ide/src/ssr.rs +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | use base_db::{FilePosition, FileRange}; | ||
2 | use ra_ide_db::RootDatabase; | ||
3 | |||
4 | use crate::SourceFileEdit; | ||
5 | use ra_ssr::{MatchFinder, SsrError, SsrRule}; | ||
6 | |||
7 | // Feature: Structural Search and Replace | ||
8 | // | ||
9 | // Search and replace with named wildcards that will match any expression, type, path, pattern or item. | ||
10 | // The syntax for a structural search replace command is `<search_pattern> ==>> <replace_pattern>`. | ||
11 | // A `$<name>` placeholder in the search pattern will match any AST node and `$<name>` will reference it in the replacement. | ||
12 | // Within a macro call, a placeholder will match up until whatever token follows the placeholder. | ||
13 | // | ||
14 | // All paths in both the search pattern and the replacement template must resolve in the context | ||
15 | // in which this command is invoked. Paths in the search pattern will then match the code if they | ||
16 | // resolve to the same item, even if they're written differently. For example if we invoke the | ||
17 | // command in the module `foo` with a pattern of `Bar`, then code in the parent module that refers | ||
18 | // to `foo::Bar` will match. | ||
19 | // | ||
20 | // Paths in the replacement template will be rendered appropriately for the context in which the | ||
21 | // replacement occurs. For example if our replacement template is `foo::Bar` and we match some | ||
22 | // code in the `foo` module, we'll insert just `Bar`. | ||
23 | // | ||
24 | // Inherent method calls should generally be written in UFCS form. e.g. `foo::Bar::baz($s, $a)` will | ||
25 | // match `$s.baz($a)`, provided the method call `baz` resolves to the method `foo::Bar::baz`. | ||
26 | // | ||
27 | // The scope of the search / replace will be restricted to the current selection if any, otherwise | ||
28 | // it will apply to the whole workspace. | ||
29 | // | ||
30 | // Placeholders may be given constraints by writing them as `${<name>:<constraint1>:<constraint2>...}`. | ||
31 | // | ||
32 | // Supported constraints: | ||
33 | // | ||
34 | // |=== | ||
35 | // | Constraint | Restricts placeholder | ||
36 | // | ||
37 | // | kind(literal) | Is a literal (e.g. `42` or `"forty two"`) | ||
38 | // | not(a) | Negates the constraint `a` | ||
39 | // |=== | ||
40 | // | ||
41 | // Available via the command `rust-analyzer.ssr`. | ||
42 | // | ||
43 | // ```rust | ||
44 | // // Using structural search replace command [foo($a, $b) ==>> ($a).foo($b)] | ||
45 | // | ||
46 | // // BEFORE | ||
47 | // String::from(foo(y + 5, z)) | ||
48 | // | ||
49 | // // AFTER | ||
50 | // String::from((y + 5).foo(z)) | ||
51 | // ``` | ||
52 | // | ||
53 | // |=== | ||
54 | // | Editor | Action Name | ||
55 | // | ||
56 | // | VS Code | **Rust Analyzer: Structural Search Replace** | ||
57 | // |=== | ||
58 | pub fn parse_search_replace( | ||
59 | rule: &str, | ||
60 | parse_only: bool, | ||
61 | db: &RootDatabase, | ||
62 | resolve_context: FilePosition, | ||
63 | selections: Vec<FileRange>, | ||
64 | ) -> Result<Vec<SourceFileEdit>, SsrError> { | ||
65 | let rule: SsrRule = rule.parse()?; | ||
66 | let mut match_finder = MatchFinder::in_context(db, resolve_context, selections); | ||
67 | match_finder.add_rule(rule)?; | ||
68 | if parse_only { | ||
69 | return Ok(Vec::new()); | ||
70 | } | ||
71 | Ok(match_finder.edits()) | ||
72 | } | ||
diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 869c74acc..c23708181 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs | |||
@@ -5,11 +5,11 @@ use base_db::{ | |||
5 | FileTextQuery, SourceRootId, | 5 | FileTextQuery, SourceRootId, |
6 | }; | 6 | }; |
7 | use hir::MacroFile; | 7 | use hir::MacroFile; |
8 | use profile::{memory_usage, Bytes}; | 8 | use ide_db::{ |
9 | use ra_ide_db::{ | ||
10 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, | 9 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, |
11 | RootDatabase, | 10 | RootDatabase, |
12 | }; | 11 | }; |
12 | use profile::{memory_usage, Bytes}; | ||
13 | use rustc_hash::FxHashMap; | 13 | use rustc_hash::FxHashMap; |
14 | use syntax::{ast, Parse, SyntaxNode}; | 14 | use syntax::{ast, Parse, SyntaxNode}; |
15 | 15 | ||
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 4b41ceb1d..5d7c7e8d0 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -5,7 +5,7 @@ mod injection; | |||
5 | mod tests; | 5 | mod tests; |
6 | 6 | ||
7 | use hir::{Name, Semantics, VariantDef}; | 7 | use hir::{Name, Semantics, VariantDef}; |
8 | use ra_ide_db::{ | 8 | use ide_db::{ |
9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, |
10 | RootDatabase, | 10 | RootDatabase, |
11 | }; | 11 | }; |
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index 17daf06b6..f80044959 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use base_db::{FileId, SourceDatabase}; | 1 | use base_db::{FileId, SourceDatabase}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::{ | 3 | use syntax::{ |
4 | algo, AstNode, NodeOrToken, SourceFile, | 4 | algo, AstNode, NodeOrToken, SourceFile, |
5 | SyntaxKind::{RAW_STRING, STRING}, | 5 | SyntaxKind::{RAW_STRING, STRING}, |
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 75f2a6b60..899ce5f26 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -16,7 +16,7 @@ | |||
16 | mod on_enter; | 16 | mod on_enter; |
17 | 17 | ||
18 | use base_db::{FilePosition, SourceDatabase}; | 18 | use base_db::{FilePosition, SourceDatabase}; |
19 | use ra_ide_db::{source_change::SourceFileEdit, RootDatabase}; | 19 | use ide_db::{source_change::SourceFileEdit, RootDatabase}; |
20 | use syntax::{ | 20 | use syntax::{ |
21 | algo::find_node_at_offset, | 21 | algo::find_node_at_offset, |
22 | ast::{self, edit::IndentLevel, AstToken}, | 22 | ast::{self, edit::IndentLevel, AstToken}, |
diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs index 193930659..f7d46146c 100644 --- a/crates/ra_ide/src/typing/on_enter.rs +++ b/crates/ra_ide/src/typing/on_enter.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! comments, but should handle indent some time in the future as well. | 2 | //! comments, but should handle indent some time in the future as well. |
3 | 3 | ||
4 | use base_db::{FilePosition, SourceDatabase}; | 4 | use base_db::{FilePosition, SourceDatabase}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{ | 6 | use syntax::{ |
7 | ast::{self, AstToken}, | 7 | ast::{self, AstToken}, |
8 | AstNode, SmolStr, SourceFile, | 8 | AstNode, SmolStr, SourceFile, |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 0dee719de..749cf648c 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -47,11 +47,11 @@ toolchain = { path = "../toolchain" } | |||
47 | 47 | ||
48 | # This should only be used in CLI | 48 | # This should only be used in CLI |
49 | base_db = { path = "../base_db" } | 49 | base_db = { path = "../base_db" } |
50 | ra_ide_db = { path = "../ra_ide_db" } | 50 | ide_db = { path = "../ide_db" } |
51 | ra_ssr = { path = "../ra_ssr" } | 51 | ssr = { path = "../ssr" } |
52 | hir = { path = "../ra_hir", package = "ra_hir" } | 52 | hir = { path = "../hir" } |
53 | hir_def = { path = "../hir_def" } | 53 | hir_def = { path = "../hir_def" } |
54 | hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" } | 54 | hir_ty = { path = "../hir_ty" } |
55 | proc_macro_srv = { path = "../proc_macro_srv" } | 55 | proc_macro_srv = { path = "../proc_macro_srv" } |
56 | 56 | ||
57 | [target.'cfg(windows)'.dependencies] | 57 | [target.'cfg(windows)'.dependencies] |
diff --git a/crates/rust-analyzer/src/bin/args.rs b/crates/rust-analyzer/src/bin/args.rs index d3081e88b..0bc92431a 100644 --- a/crates/rust-analyzer/src/bin/args.rs +++ b/crates/rust-analyzer/src/bin/args.rs | |||
@@ -7,8 +7,8 @@ use std::{env, fmt::Write, path::PathBuf}; | |||
7 | 7 | ||
8 | use anyhow::{bail, Result}; | 8 | use anyhow::{bail, Result}; |
9 | use pico_args::Arguments; | 9 | use pico_args::Arguments; |
10 | use ra_ssr::{SsrPattern, SsrRule}; | ||
11 | use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity}; | 10 | use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity}; |
11 | use ssr::{SsrPattern, SsrRule}; | ||
12 | use vfs::AbsPathBuf; | 12 | use vfs::AbsPathBuf; |
13 | 13 | ||
14 | pub(crate) struct Args { | 14 | pub(crate) struct Args { |
diff --git a/crates/rust-analyzer/src/cli.rs b/crates/rust-analyzer/src/cli.rs index 420abaccb..b237a94d1 100644 --- a/crates/rust-analyzer/src/cli.rs +++ b/crates/rust-analyzer/src/cli.rs | |||
@@ -13,11 +13,13 @@ use anyhow::Result; | |||
13 | use ra_ide::Analysis; | 13 | use ra_ide::Analysis; |
14 | use syntax::{AstNode, SourceFile}; | 14 | use syntax::{AstNode, SourceFile}; |
15 | 15 | ||
16 | pub use analysis_bench::{BenchCmd, BenchWhat, Position}; | 16 | pub use self::{ |
17 | pub use analysis_stats::AnalysisStatsCmd; | 17 | analysis_bench::{BenchCmd, BenchWhat, Position}, |
18 | pub use diagnostics::diagnostics; | 18 | analysis_stats::AnalysisStatsCmd, |
19 | pub use load_cargo::load_cargo; | 19 | diagnostics::diagnostics, |
20 | pub use ssr::{apply_ssr_rules, search_for_patterns}; | 20 | load_cargo::load_cargo, |
21 | ssr::{apply_ssr_rules, search_for_patterns}, | ||
22 | }; | ||
21 | 23 | ||
22 | #[derive(Clone, Copy)] | 24 | #[derive(Clone, Copy)] |
23 | pub enum Verbosity { | 25 | pub enum Verbosity { |
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs index 08788fb41..c11e10943 100644 --- a/crates/rust-analyzer/src/cli/ssr.rs +++ b/crates/rust-analyzer/src/cli/ssr.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Applies structured search replace rules from the command line. | 1 | //! Applies structured search replace rules from the command line. |
2 | 2 | ||
3 | use crate::cli::{load_cargo::load_cargo, Result}; | 3 | use crate::cli::{load_cargo::load_cargo, Result}; |
4 | use ra_ssr::{MatchFinder, SsrPattern, SsrRule}; | 4 | use ssr::{MatchFinder, SsrPattern, SsrRule}; |
5 | 5 | ||
6 | pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | 6 | pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { |
7 | use base_db::SourceDatabaseExt; | 7 | use base_db::SourceDatabaseExt; |
@@ -27,7 +27,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | |||
27 | /// for much else. | 27 | /// for much else. |
28 | pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> { | 28 | pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> { |
29 | use base_db::SourceDatabaseExt; | 29 | use base_db::SourceDatabaseExt; |
30 | use ra_ide_db::symbol_index::SymbolsDatabase; | 30 | use ide_db::symbol_index::SymbolsDatabase; |
31 | let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?; | 31 | let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?; |
32 | let db = host.raw_database(); | 32 | let db = host.raw_database(); |
33 | let mut match_finder = MatchFinder::at_first_file(db)?; | 33 | let mut match_finder = MatchFinder::at_first_file(db)?; |
diff --git a/crates/ra_ssr/Cargo.toml b/crates/ssr/Cargo.toml index f290939cf..cd05eeecc 100644 --- a/crates/ra_ssr/Cargo.toml +++ b/crates/ssr/Cargo.toml | |||
@@ -1,22 +1,23 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "ssr" |
3 | name = "ra_ssr" | ||
4 | version = "0.1.0" | 3 | version = "0.1.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | ||
7 | description = "Structural search and replace of Rust code" | 4 | description = "Structural search and replace of Rust code" |
5 | license = "MIT OR Apache-2.0" | ||
8 | repository = "https://github.com/rust-analyzer/rust-analyzer" | 6 | repository = "https://github.com/rust-analyzer/rust-analyzer" |
7 | authors = ["rust-analyzer developers"] | ||
8 | edition = "2018" | ||
9 | 9 | ||
10 | [lib] | 10 | [lib] |
11 | doctest = false | 11 | doctest = false |
12 | 12 | ||
13 | [dependencies] | 13 | [dependencies] |
14 | rustc-hash = "1.1.0" | ||
15 | |||
14 | text_edit = { path = "../text_edit" } | 16 | text_edit = { path = "../text_edit" } |
15 | syntax = { path = "../syntax" } | 17 | syntax = { path = "../syntax" } |
16 | base_db = { path = "../base_db" } | 18 | base_db = { path = "../base_db" } |
17 | ra_ide_db = { path = "../ra_ide_db" } | 19 | ide_db = { path = "../ide_db" } |
18 | hir = { path = "../ra_hir", package = "ra_hir" } | 20 | hir = { path = "../hir" } |
19 | rustc-hash = "1.1.0" | ||
20 | test_utils = { path = "../test_utils" } | 21 | test_utils = { path = "../test_utils" } |
21 | 22 | ||
22 | [dev-dependencies] | 23 | [dev-dependencies] |
diff --git a/crates/ra_ssr/src/errors.rs b/crates/ssr/src/errors.rs index c02bacae6..c02bacae6 100644 --- a/crates/ra_ssr/src/errors.rs +++ b/crates/ssr/src/errors.rs | |||
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ssr/src/lib.rs index 6725582e4..292bd5b9a 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ssr/src/lib.rs | |||
@@ -3,6 +3,58 @@ | |||
3 | //! Allows searching the AST for code that matches one or more patterns and then replacing that code | 3 | //! Allows searching the AST for code that matches one or more patterns and then replacing that code |
4 | //! based on a template. | 4 | //! based on a template. |
5 | 5 | ||
6 | // Feature: Structural Search and Replace | ||
7 | // | ||
8 | // Search and replace with named wildcards that will match any expression, type, path, pattern or item. | ||
9 | // The syntax for a structural search replace command is `<search_pattern> ==>> <replace_pattern>`. | ||
10 | // A `$<name>` placeholder in the search pattern will match any AST node and `$<name>` will reference it in the replacement. | ||
11 | // Within a macro call, a placeholder will match up until whatever token follows the placeholder. | ||
12 | // | ||
13 | // All paths in both the search pattern and the replacement template must resolve in the context | ||
14 | // in which this command is invoked. Paths in the search pattern will then match the code if they | ||
15 | // resolve to the same item, even if they're written differently. For example if we invoke the | ||
16 | // command in the module `foo` with a pattern of `Bar`, then code in the parent module that refers | ||
17 | // to `foo::Bar` will match. | ||
18 | // | ||
19 | // Paths in the replacement template will be rendered appropriately for the context in which the | ||
20 | // replacement occurs. For example if our replacement template is `foo::Bar` and we match some | ||
21 | // code in the `foo` module, we'll insert just `Bar`. | ||
22 | // | ||
23 | // Inherent method calls should generally be written in UFCS form. e.g. `foo::Bar::baz($s, $a)` will | ||
24 | // match `$s.baz($a)`, provided the method call `baz` resolves to the method `foo::Bar::baz`. | ||
25 | // | ||
26 | // The scope of the search / replace will be restricted to the current selection if any, otherwise | ||
27 | // it will apply to the whole workspace. | ||
28 | // | ||
29 | // Placeholders may be given constraints by writing them as `${<name>:<constraint1>:<constraint2>...}`. | ||
30 | // | ||
31 | // Supported constraints: | ||
32 | // | ||
33 | // |=== | ||
34 | // | Constraint | Restricts placeholder | ||
35 | // | ||
36 | // | kind(literal) | Is a literal (e.g. `42` or `"forty two"`) | ||
37 | // | not(a) | Negates the constraint `a` | ||
38 | // |=== | ||
39 | // | ||
40 | // Available via the command `rust-analyzer.ssr`. | ||
41 | // | ||
42 | // ```rust | ||
43 | // // Using structural search replace command [foo($a, $b) ==>> ($a).foo($b)] | ||
44 | // | ||
45 | // // BEFORE | ||
46 | // String::from(foo(y + 5, z)) | ||
47 | // | ||
48 | // // AFTER | ||
49 | // String::from((y + 5).foo(z)) | ||
50 | // ``` | ||
51 | // | ||
52 | // |=== | ||
53 | // | Editor | Action Name | ||
54 | // | ||
55 | // | VS Code | **Rust Analyzer: Structural Search Replace** | ||
56 | // |=== | ||
57 | |||
6 | mod matching; | 58 | mod matching; |
7 | mod nester; | 59 | mod nester; |
8 | mod parsing; | 60 | mod parsing; |
@@ -20,7 +72,7 @@ pub use crate::matching::Match; | |||
20 | use crate::matching::MatchFailureReason; | 72 | use crate::matching::MatchFailureReason; |
21 | use base_db::{FileId, FilePosition, FileRange}; | 73 | use base_db::{FileId, FilePosition, FileRange}; |
22 | use hir::Semantics; | 74 | use hir::Semantics; |
23 | use ra_ide_db::source_change::SourceFileEdit; | 75 | use ide_db::source_change::SourceFileEdit; |
24 | use resolving::ResolvedRule; | 76 | use resolving::ResolvedRule; |
25 | use rustc_hash::FxHashMap; | 77 | use rustc_hash::FxHashMap; |
26 | use syntax::{ast, AstNode, SyntaxNode, TextRange}; | 78 | use syntax::{ast, AstNode, SyntaxNode, TextRange}; |
@@ -49,7 +101,7 @@ pub struct SsrMatches { | |||
49 | /// Searches a crate for pattern matches and possibly replaces them with something else. | 101 | /// Searches a crate for pattern matches and possibly replaces them with something else. |
50 | pub struct MatchFinder<'db> { | 102 | pub struct MatchFinder<'db> { |
51 | /// Our source of information about the user's code. | 103 | /// Our source of information about the user's code. |
52 | sema: Semantics<'db, ra_ide_db::RootDatabase>, | 104 | sema: Semantics<'db, ide_db::RootDatabase>, |
53 | rules: Vec<ResolvedRule>, | 105 | rules: Vec<ResolvedRule>, |
54 | resolution_scope: resolving::ResolutionScope<'db>, | 106 | resolution_scope: resolving::ResolutionScope<'db>, |
55 | restrict_ranges: Vec<FileRange>, | 107 | restrict_ranges: Vec<FileRange>, |
@@ -59,7 +111,7 @@ impl<'db> MatchFinder<'db> { | |||
59 | /// Constructs a new instance where names will be looked up as if they appeared at | 111 | /// Constructs a new instance where names will be looked up as if they appeared at |
60 | /// `lookup_context`. | 112 | /// `lookup_context`. |
61 | pub fn in_context( | 113 | pub fn in_context( |
62 | db: &'db ra_ide_db::RootDatabase, | 114 | db: &'db ide_db::RootDatabase, |
63 | lookup_context: FilePosition, | 115 | lookup_context: FilePosition, |
64 | mut restrict_ranges: Vec<FileRange>, | 116 | mut restrict_ranges: Vec<FileRange>, |
65 | ) -> MatchFinder<'db> { | 117 | ) -> MatchFinder<'db> { |
@@ -70,9 +122,9 @@ impl<'db> MatchFinder<'db> { | |||
70 | } | 122 | } |
71 | 123 | ||
72 | /// Constructs an instance using the start of the first file in `db` as the lookup context. | 124 | /// Constructs an instance using the start of the first file in `db` as the lookup context. |
73 | pub fn at_first_file(db: &'db ra_ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { | 125 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { |
74 | use base_db::SourceDatabaseExt; | 126 | use base_db::SourceDatabaseExt; |
75 | use ra_ide_db::symbol_index::SymbolsDatabase; | 127 | use ide_db::symbol_index::SymbolsDatabase; |
76 | if let Some(first_file_id) = db | 128 | if let Some(first_file_id) = db |
77 | .local_roots() | 129 | .local_roots() |
78 | .iter() | 130 | .iter() |
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ssr/src/matching.rs index e81a87c47..ffc7202ae 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ssr/src/matching.rs | |||
@@ -92,7 +92,7 @@ pub(crate) fn get_match( | |||
92 | rule: &ResolvedRule, | 92 | rule: &ResolvedRule, |
93 | code: &SyntaxNode, | 93 | code: &SyntaxNode, |
94 | restrict_range: &Option<FileRange>, | 94 | restrict_range: &Option<FileRange>, |
95 | sema: &Semantics<ra_ide_db::RootDatabase>, | 95 | sema: &Semantics<ide_db::RootDatabase>, |
96 | ) -> Result<Match, MatchFailed> { | 96 | ) -> Result<Match, MatchFailed> { |
97 | record_match_fails_reasons_scope(debug_active, || { | 97 | record_match_fails_reasons_scope(debug_active, || { |
98 | Matcher::try_match(rule, code, restrict_range, sema) | 98 | Matcher::try_match(rule, code, restrict_range, sema) |
@@ -101,7 +101,7 @@ pub(crate) fn get_match( | |||
101 | 101 | ||
102 | /// Checks if our search pattern matches a particular node of the AST. | 102 | /// Checks if our search pattern matches a particular node of the AST. |
103 | struct Matcher<'db, 'sema> { | 103 | struct Matcher<'db, 'sema> { |
104 | sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>, | 104 | sema: &'sema Semantics<'db, ide_db::RootDatabase>, |
105 | /// If any placeholders come from anywhere outside of this range, then the match will be | 105 | /// If any placeholders come from anywhere outside of this range, then the match will be |
106 | /// rejected. | 106 | /// rejected. |
107 | restrict_range: Option<FileRange>, | 107 | restrict_range: Option<FileRange>, |
@@ -123,7 +123,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
123 | rule: &ResolvedRule, | 123 | rule: &ResolvedRule, |
124 | code: &SyntaxNode, | 124 | code: &SyntaxNode, |
125 | restrict_range: &Option<FileRange>, | 125 | restrict_range: &Option<FileRange>, |
126 | sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>, | 126 | sema: &'sema Semantics<'db, ide_db::RootDatabase>, |
127 | ) -> Result<Match, MatchFailed> { | 127 | ) -> Result<Match, MatchFailed> { |
128 | let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule }; | 128 | let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule }; |
129 | // First pass at matching, where we check that node types and idents match. | 129 | // First pass at matching, where we check that node types and idents match. |
@@ -606,7 +606,7 @@ impl Match { | |||
606 | fn render_template_paths( | 606 | fn render_template_paths( |
607 | &mut self, | 607 | &mut self, |
608 | template: &ResolvedPattern, | 608 | template: &ResolvedPattern, |
609 | sema: &Semantics<ra_ide_db::RootDatabase>, | 609 | sema: &Semantics<ide_db::RootDatabase>, |
610 | ) -> Result<(), MatchFailed> { | 610 | ) -> Result<(), MatchFailed> { |
611 | let module = sema | 611 | let module = sema |
612 | .scope(&self.matched_node) | 612 | .scope(&self.matched_node) |
diff --git a/crates/ra_ssr/src/nester.rs b/crates/ssr/src/nester.rs index 8be570d3c..6ac355dfc 100644 --- a/crates/ra_ssr/src/nester.rs +++ b/crates/ssr/src/nester.rs | |||
@@ -13,7 +13,7 @@ use syntax::SyntaxNode; | |||
13 | 13 | ||
14 | pub(crate) fn nest_and_remove_collisions( | 14 | pub(crate) fn nest_and_remove_collisions( |
15 | mut matches: Vec<Match>, | 15 | mut matches: Vec<Match>, |
16 | sema: &hir::Semantics<ra_ide_db::RootDatabase>, | 16 | sema: &hir::Semantics<ide_db::RootDatabase>, |
17 | ) -> SsrMatches { | 17 | ) -> SsrMatches { |
18 | // We sort the matches by depth then by rule index. Sorting by depth means that by the time we | 18 | // We sort the matches by depth then by rule index. Sorting by depth means that by the time we |
19 | // see a match, any parent matches or conflicting matches will have already been seen. Sorting | 19 | // see a match, any parent matches or conflicting matches will have already been seen. Sorting |
@@ -36,7 +36,7 @@ impl MatchCollector { | |||
36 | /// Attempts to add `m` to matches. If it conflicts with an existing match, it is discarded. If | 36 | /// Attempts to add `m` to matches. If it conflicts with an existing match, it is discarded. If |
37 | /// it is entirely within the a placeholder of an existing match, then it is added as a child | 37 | /// it is entirely within the a placeholder of an existing match, then it is added as a child |
38 | /// match of the existing match. | 38 | /// match of the existing match. |
39 | fn add_match(&mut self, m: Match, sema: &hir::Semantics<ra_ide_db::RootDatabase>) { | 39 | fn add_match(&mut self, m: Match, sema: &hir::Semantics<ide_db::RootDatabase>) { |
40 | let matched_node = m.matched_node.clone(); | 40 | let matched_node = m.matched_node.clone(); |
41 | if let Some(existing) = self.matches_by_node.get_mut(&matched_node) { | 41 | if let Some(existing) = self.matches_by_node.get_mut(&matched_node) { |
42 | try_add_sub_match(m, existing, sema); | 42 | try_add_sub_match(m, existing, sema); |
@@ -53,11 +53,7 @@ impl MatchCollector { | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /// Attempts to add `m` as a sub-match of `existing`. | 55 | /// Attempts to add `m` as a sub-match of `existing`. |
56 | fn try_add_sub_match( | 56 | fn try_add_sub_match(m: Match, existing: &mut Match, sema: &hir::Semantics<ide_db::RootDatabase>) { |
57 | m: Match, | ||
58 | existing: &mut Match, | ||
59 | sema: &hir::Semantics<ra_ide_db::RootDatabase>, | ||
60 | ) { | ||
61 | for p in existing.placeholder_values.values_mut() { | 57 | for p in existing.placeholder_values.values_mut() { |
62 | // Note, no need to check if p.range.file is equal to m.range.file, since we | 58 | // Note, no need to check if p.range.file is equal to m.range.file, since we |
63 | // already know we're within `existing`. | 59 | // already know we're within `existing`. |
diff --git a/crates/ra_ssr/src/parsing.rs b/crates/ssr/src/parsing.rs index 9570e96e3..9570e96e3 100644 --- a/crates/ra_ssr/src/parsing.rs +++ b/crates/ssr/src/parsing.rs | |||
diff --git a/crates/ra_ssr/src/replacing.rs b/crates/ssr/src/replacing.rs index 8f8fe6149..8f8fe6149 100644 --- a/crates/ra_ssr/src/replacing.rs +++ b/crates/ssr/src/replacing.rs | |||
diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ssr/src/resolving.rs index dac09bae8..020fd7994 100644 --- a/crates/ra_ssr/src/resolving.rs +++ b/crates/ssr/src/resolving.rs | |||
@@ -187,7 +187,7 @@ impl Resolver<'_, '_> { | |||
187 | 187 | ||
188 | impl<'db> ResolutionScope<'db> { | 188 | impl<'db> ResolutionScope<'db> { |
189 | pub(crate) fn new( | 189 | pub(crate) fn new( |
190 | sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>, | 190 | sema: &hir::Semantics<'db, ide_db::RootDatabase>, |
191 | resolve_context: FilePosition, | 191 | resolve_context: FilePosition, |
192 | ) -> ResolutionScope<'db> { | 192 | ) -> ResolutionScope<'db> { |
193 | use syntax::ast::AstNode; | 193 | use syntax::ast::AstNode; |
diff --git a/crates/ra_ssr/src/search.rs b/crates/ssr/src/search.rs index 434953fb4..8509cfa4d 100644 --- a/crates/ra_ssr/src/search.rs +++ b/crates/ssr/src/search.rs | |||
@@ -6,7 +6,7 @@ use crate::{ | |||
6 | Match, MatchFinder, | 6 | Match, MatchFinder, |
7 | }; | 7 | }; |
8 | use base_db::{FileId, FileRange}; | 8 | use base_db::{FileId, FileRange}; |
9 | use ra_ide_db::{ | 9 | use ide_db::{ |
10 | defs::Definition, | 10 | defs::Definition, |
11 | search::{Reference, SearchScope}, | 11 | search::{Reference, SearchScope}, |
12 | }; | 12 | }; |
@@ -146,7 +146,7 @@ impl<'db> MatchFinder<'db> { | |||
146 | if self.restrict_ranges.is_empty() { | 146 | if self.restrict_ranges.is_empty() { |
147 | // Unrestricted search. | 147 | // Unrestricted search. |
148 | use base_db::SourceDatabaseExt; | 148 | use base_db::SourceDatabaseExt; |
149 | use ra_ide_db::symbol_index::SymbolsDatabase; | 149 | use ide_db::symbol_index::SymbolsDatabase; |
150 | for &root in self.sema.db.local_roots().iter() { | 150 | for &root in self.sema.db.local_roots().iter() { |
151 | let sr = self.sema.db.source_root(root); | 151 | let sr = self.sema.db.source_root(root); |
152 | for file_id in sr.iter() { | 152 | for file_id in sr.iter() { |
diff --git a/crates/ra_ssr/src/tests.rs b/crates/ssr/src/tests.rs index 54c3da9db..0d0a00090 100644 --- a/crates/ra_ssr/src/tests.rs +++ b/crates/ssr/src/tests.rs | |||
@@ -61,13 +61,13 @@ fn parser_undefined_placeholder_in_replacement() { | |||
61 | 61 | ||
62 | /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be | 62 | /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be |
63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. | 63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. |
64 | pub(crate) fn single_file(code: &str) -> (ra_ide_db::RootDatabase, FilePosition, Vec<FileRange>) { | 64 | pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { |
65 | use base_db::fixture::WithFixture; | 65 | use base_db::fixture::WithFixture; |
66 | use ra_ide_db::symbol_index::SymbolsDatabase; | 66 | use ide_db::symbol_index::SymbolsDatabase; |
67 | let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { | 67 | let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { |
68 | ra_ide_db::RootDatabase::with_range_or_offset(code) | 68 | ide_db::RootDatabase::with_range_or_offset(code) |
69 | } else { | 69 | } else { |
70 | let (db, file_id) = ra_ide_db::RootDatabase::with_single_file(code); | 70 | let (db, file_id) = ide_db::RootDatabase::with_single_file(code); |
71 | (db, file_id, RangeOrOffset::Offset(0.into())) | 71 | (db, file_id, RangeOrOffset::Offset(0.into())) |
72 | }; | 72 | }; |
73 | let selections; | 73 | let selections; |