Skip to content

Commit bf84e49

Browse files
bors[bot]JoshMcguiganpopzxc
authored
Merge #6331 #6342
6331: correct hover text for items with doc attribute with raw strings r=matklad a=JoshMcguigan Fixes #6300 by improving the handling of raw string literals in attribute style doc comments. This still has a bug where it could consume too many `"` at the start or end of the comment text, just as the original code had. Not sure if we want to fix that as part of this PR or not? If so, I think I'd prefer to add a unit test for either the `as_simple_key_value` function (I'm not exactly sure where this would belong / how to set this up) or create a `fn(&SmolStr) -> &SmolStr` to unit test by factoring out the `trim` operations from `as_simple_key_value`. Thoughts on this? 6342: Shorter dependency chain r=matklad a=popzxc Continuing implementing suggestions from the `Completion refactoring` zulip thread. This PR does the following: - Removes dependency of `completions` on `assists` by moving required functionality into `ide_db`. - Moves completely `call_info` crate into `ide_db` as it looks like it fits perfect there. - Adds a bunch of new tests and docs. - Adds the re-export of `base_db` to the `ide_db` and removes direct dependency on `base_db` from other crates. The last point is controversial, I guess, but I noticed that in places where `ide_db` is used, `base_db` is also *always* used. Thus I think the dependency on the `base_db` is implied by the fact of `ide_db` interfaces, and thus it makes sense to just provide `base_db` out of the box. Co-authored-by: Josh Mcguigan <[email protected]> Co-authored-by: Igor Aleksanov <[email protected]>
3 parents 11e18c3 + 4e76e88 + 19cce08 commit bf84e49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+421
-259
lines changed

Cargo.lock

Lines changed: 1 addition & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/assists/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ stdx = { path = "../stdx", version = "0.0.0" }
1818
syntax = { path = "../syntax", version = "0.0.0" }
1919
text_edit = { path = "../text_edit", version = "0.0.0" }
2020
profile = { path = "../profile", version = "0.0.0" }
21-
base_db = { path = "../base_db", version = "0.0.0" }
2221
ide_db = { path = "../ide_db", version = "0.0.0" }
2322
hir = { path = "../hir", version = "0.0.0" }
2423
test_utils = { path = "../test_utils", version = "0.0.0" }

crates/assists/src/assist_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::mem;
44

55
use algo::find_covering_element;
6-
use base_db::{FileId, FileRange};
76
use hir::Semantics;
7+
use ide_db::base_db::{FileId, FileRange};
88
use ide_db::{
99
label::Label,
1010
source_change::{SourceChange, SourceFileEdit},

crates/assists/src/handlers/add_missing_impl_members.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use hir::HasSource;
2+
use ide_db::traits::{get_missing_assoc_items, resolve_target_trait};
23
use syntax::{
34
ast::{
45
self,
@@ -11,7 +12,7 @@ use syntax::{
1112
use crate::{
1213
assist_context::{AssistContext, Assists},
1314
ast_transform::{self, AstTransform, QualifyPaths, SubstituteTypeParams},
14-
utils::{get_missing_assoc_items, render_snippet, resolve_target_trait, Cursor},
15+
utils::{render_snippet, Cursor},
1516
AssistId, AssistKind,
1617
};
1718

crates/assists/src/handlers/extract_struct_from_enum_variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use base_db::FileId;
21
use hir::{EnumVariant, Module, ModuleDef, Name};
2+
use ide_db::base_db::FileId;
33
use ide_db::{defs::Definition, search::Reference, RootDatabase};
44
use itertools::Itertools;
55
use rustc_hash::FxHashSet;

crates/assists/src/handlers/fix_visibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use base_db::FileId;
21
use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution};
2+
use ide_db::base_db::FileId;
33
use syntax::{
44
ast::{self, VisibilityOwner},
55
AstNode, TextRange, TextSize,

crates/assists/src/handlers/generate_function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use base_db::FileId;
21
use hir::HirDisplay;
2+
use ide_db::base_db::FileId;
33
use rustc_hash::{FxHashMap, FxHashSet};
44
use syntax::{
55
ast::{

crates/assists/src/handlers/replace_if_let_with_match.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ use syntax::{
77
AstNode,
88
};
99

10-
use crate::{
11-
utils::{unwrap_trivial_block, TryEnum},
12-
AssistContext, AssistId, AssistKind, Assists,
13-
};
10+
use crate::{utils::unwrap_trivial_block, AssistContext, AssistId, AssistKind, Assists};
11+
use ide_db::ty_filter::TryEnum;
1412

1513
// Assist: replace_if_let_with_match
1614
//

crates/assists/src/handlers/replace_let_with_if_let.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use syntax::{
99
AstNode, T,
1010
};
1111

12-
use crate::{utils::TryEnum, AssistContext, AssistId, AssistKind, Assists};
12+
use crate::{AssistContext, AssistId, AssistKind, Assists};
13+
use ide_db::ty_filter::TryEnum;
1314

1415
// Assist: replace_let_with_if_let
1516
//

crates/assists/src/handlers/replace_unwrap_with_match.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ use syntax::{
1010
};
1111

1212
use crate::{
13-
utils::{render_snippet, Cursor, TryEnum},
13+
utils::{render_snippet, Cursor},
1414
AssistContext, AssistId, AssistKind, Assists,
1515
};
16+
use ide_db::ty_filter::TryEnum;
1617

1718
// Assist: replace_unwrap_with_match
1819
//

0 commit comments

Comments
 (0)