Skip to content

⬆️ rust-analyzer #104211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Nov 10, 2022
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0f46f27
Migrate most of `ide_assists::utils` to format arg capture
DropDemBits Oct 10, 2022
d439fb2
Migrate assists to format args captures, part 1
DropDemBits Oct 10, 2022
b1909a8
Migrate assists to format args captures, part 3
DropDemBits Oct 10, 2022
8ebc96a
fix broken links in guide.md
notJoon Oct 20, 2022
e4ef0e5
addressed https://github.com/rust-lang/rust-analyzer/issues/12536
justinmmott Oct 21, 2022
8039a07
ide: Generate monikers for local crates.
emilio Oct 22, 2022
c4bdb8e
feat: add config for inserting must_use in `generate_enum_as_method`
feniljain Oct 6, 2022
4bf9b9b
refactor: remove repetitive string interpolation and doc changes
feniljain Oct 24, 2022
4a7f5ca
fix: async trait method for `unnecessary_async`
koka831 Oct 28, 2022
cf90e4f
Simplify the procedure
koka831 Oct 29, 2022
319611b
Record diverging match arms in `InferenceResult`
unexge Oct 29, 2022
48efc9d
Add `Convert match to let-else` assist
unexge Oct 29, 2022
f0a1434
Update auto generated tests
unexge Oct 29, 2022
98125b9
fix: make custom expr prefix completions to understand refs
feniljain Oct 30, 2022
8142d1f
Auto merge of #13445 - notJoon:modify-dead-links, r=lnicola
bors Oct 31, 2022
db8c752
fix: disregard type variable expectation for if expressions
lowr Oct 31, 2022
07f6efc
Auto merge of #13523 - lowr:fix/adjust-expectation-for-if, r=lnicola
bors Oct 31, 2022
ecad1a9
Create `Callable`s for generic types implementing `FnOnce`
Nov 1, 2022
9f1bb17
Import `option` in the tests
Nov 1, 2022
e110c78
Revert "Record diverging match arms in `InferenceResult`"
Nov 1, 2022
72d5b45
Fix doc test
Nov 1, 2022
d90cb1e
Auto merge of #13516 - unexge:add-convert-match-to-let-else-assist, r…
bors Nov 1, 2022
a8e97bc
Auto merge of #13508 - koka831:fix/13492, r=jonas-schievink
bors Nov 1, 2022
c1305fa
Auto merge of #13525 - jonas-schievink:generic-call-signature, r=jona…
bors Nov 1, 2022
62a6cdf
Use let-else statements in `Convert to guarded return` assist
unexge Nov 1, 2022
12ced8f
Auto merge of #13517 - feniljain:fix_completions, r=Veykril
bors Nov 2, 2022
691ce30
fix: indentation after inserting `#must_use`
feniljain Nov 2, 2022
af1f48d
Auto merge of #13359 - feniljain:feat-must-use-option, r=Veykril
bors Nov 2, 2022
6c3ab56
Auto merge of #13527 - unexge:use-let-else-stmt-in-convert-to-guarded…
bors Nov 2, 2022
adee109
Bump ovsx
lnicola Nov 2, 2022
56c97a8
Auto merge of #13530 - lnicola:bump-ovsx, r=lnicola
bors Nov 2, 2022
08c2b45
docs: add crates section to the manual
pd4d10 Nov 3, 2022
6073e58
Allow ovsx publishing to fail
lnicola Nov 3, 2022
f3a6871
Auto merge of #13537 - lnicola:ovsx-fail, r=lnicola
bors Nov 3, 2022
bbcb77e
Auto merge of #13456 - emilio:scip-local-symbol, r=Veykril
bors Nov 3, 2022
6750f6b
Clarify what commands are debug commands in VSCode
Veykril Nov 3, 2022
3508820
Add rustbot features related to PR state labels
HKalbasi Nov 4, 2022
ad633db
Auto merge of #13544 - HKalbasi:patch-2, r=Veykril
bors Nov 4, 2022
6f09c72
Lower unsafety of fn pointer and fn item types
Veykril Nov 4, 2022
cd26032
Auto merge of #13546 - Veykril:unsafe-fn-ptr, r=Veykril
bors Nov 4, 2022
26b5621
Mark the Memory Usage command as debug command
Veykril Nov 4, 2022
66900a7
Auto merge of #13541 - Veykril:dbg-cmd, r=Veykril
bors Nov 4, 2022
df38770
Auto merge of #13454 - justinmmott:master, r=flodiebold
bors Nov 5, 2022
17619de
fix: Fix reference searching only accounting substrings instead of wh…
Veykril Nov 5, 2022
2c37e7d
Auto merge of #13549 - Veykril:search-fix, r=Veykril
bors Nov 5, 2022
afe8f6b
Auto merge of #13379 - DropDemBits:ide-assists-format-args-capture, r…
bors Nov 5, 2022
ef46168
minor: Update github issue templates
Veykril Nov 5, 2022
25b1d6f
Auto merge of #13435 - DropDemBits:assists-format-args-capture-pt3, r…
bors Nov 5, 2022
c06bbfb
Auto merge of #13536 - pd4d10:patch-1, r=Veykril
bors Nov 5, 2022
e47460b
Auto merge of #13550 - Veykril:issue-template, r=lnicola
bors Nov 5, 2022
935eb3f
docs: fix adoc links
pd4d10 Nov 5, 2022
d03c1c8
Auto merge of #13556 - pd4d10:patch-1, r=lnicola
bors Nov 5, 2022
ff118a8
:arrow_up: rust-analyzer
lnicola Nov 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ide: Generate monikers for local crates.
emilio committed Oct 22, 2022

Verified

This commit was signed with the committer’s verified signature.
emilio Emilio Cobos Álvarez
commit 8039a07a5e13fa0690b56f3c6074e5581a4fd4c5
28 changes: 14 additions & 14 deletions crates/ide/src/moniker.rs
Original file line number Diff line number Diff line change
@@ -73,8 +73,8 @@ impl MonikerResult {
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct PackageInformation {
pub name: String,
pub repo: String,
pub version: String,
pub repo: Option<String>,
pub version: Option<String>,
}

pub(crate) fn crate_for_file(db: &RootDatabase, file_id: FileId) -> Option<Crate> {
@@ -256,18 +256,18 @@ pub(crate) fn def_to_moniker(
let (name, repo, version) = match krate.origin(db) {
CrateOrigin::CratesIo { repo, name } => (
name.unwrap_or(krate.display_name(db)?.canonical_name().to_string()),
repo?,
krate.version(db)?,
repo,
krate.version(db),
),
CrateOrigin::Lang(lang) => (
krate.display_name(db)?.canonical_name().to_string(),
"https://github.com/rust-lang/rust/".to_string(),
match lang {
Some("https://github.com/rust-lang/rust/".to_string()),
Some(match lang {
LangCrateOrigin::Other => {
"https://github.com/rust-lang/rust/library/".into()
}
lang => format!("https://github.com/rust-lang/rust/library/{lang}",),
},
}),
),
};
PackageInformation { name, repo, version }
@@ -315,7 +315,7 @@ pub mod module {
}
"#,
"foo::module::func",
r#"PackageInformation { name: "foo", repo: "https://a.b/foo.git", version: "0.1.0" }"#,
r#"PackageInformation { name: "foo", repo: Some("https://a.b/foo.git"), version: Some("0.1.0") }"#,
MonikerKind::Import,
);
check_moniker(
@@ -331,7 +331,7 @@ pub mod module {
}
"#,
"foo::module::func",
r#"PackageInformation { name: "foo", repo: "https://a.b/foo.git", version: "0.1.0" }"#,
r#"PackageInformation { name: "foo", repo: Some("https://a.b/foo.git"), version: Some("0.1.0") }"#,
MonikerKind::Export,
);
}
@@ -348,7 +348,7 @@ pub mod module {
}
"#,
"foo::module::MyTrait::func",
r#"PackageInformation { name: "foo", repo: "https://a.b/foo.git", version: "0.1.0" }"#,
r#"PackageInformation { name: "foo", repo: Some("https://a.b/foo.git"), version: Some("0.1.0") }"#,
MonikerKind::Export,
);
}
@@ -365,7 +365,7 @@ pub mod module {
}
"#,
"foo::module::MyTrait::MY_CONST",
r#"PackageInformation { name: "foo", repo: "https://a.b/foo.git", version: "0.1.0" }"#,
r#"PackageInformation { name: "foo", repo: Some("https://a.b/foo.git"), version: Some("0.1.0") }"#,
MonikerKind::Export,
);
}
@@ -382,7 +382,7 @@ pub mod module {
}
"#,
"foo::module::MyTrait::MyType",
r#"PackageInformation { name: "foo", repo: "https://a.b/foo.git", version: "0.1.0" }"#,
r#"PackageInformation { name: "foo", repo: Some("https://a.b/foo.git"), version: Some("0.1.0") }"#,
MonikerKind::Export,
);
}
@@ -405,7 +405,7 @@ pub mod module {
}
"#,
"foo::module::MyStruct::MyTrait::func",
r#"PackageInformation { name: "foo", repo: "https://a.b/foo.git", version: "0.1.0" }"#,
r#"PackageInformation { name: "foo", repo: Some("https://a.b/foo.git"), version: Some("0.1.0") }"#,
MonikerKind::Export,
);
}
@@ -425,7 +425,7 @@ pub struct St {
}
"#,
"foo::St::a",
r#"PackageInformation { name: "foo", repo: "https://a.b/foo.git", version: "0.1.0" }"#,
r#"PackageInformation { name: "foo", repo: Some("https://a.b/foo.git"), version: Some("0.1.0") }"#,
MonikerKind::Import,
);
}
6 changes: 3 additions & 3 deletions crates/rust-analyzer/src/cli/lsif.rs
Original file line number Diff line number Diff line change
@@ -106,12 +106,12 @@ impl LsifManager<'_> {
manager: "cargo".to_string(),
uri: None,
content: None,
repository: Some(lsif::Repository {
url: pi.repo,
repository: pi.repo.map(|url| lsif::Repository {
url,
r#type: "git".to_string(),
commit_id: None,
}),
version: Some(pi.version),
version: pi.version,
}));
self.package_map.insert(package_information, result_set_id);
result_set_id
40 changes: 39 additions & 1 deletion crates/rust-analyzer/src/cli/scip.rs
Original file line number Diff line number Diff line change
@@ -231,7 +231,7 @@ fn token_to_symbol(token: &TokenStaticData) -> Option<scip_types::Symbol> {
package: Some(scip_types::Package {
manager: "cargo".to_string(),
name: package_name,
version,
version: version.unwrap_or_else(|| ".".to_string()),
..Default::default()
})
.into(),
@@ -415,4 +415,42 @@ pub mod module {
"",
);
}

#[test]
fn global_symbol_for_pub_struct() {
check_symbol(
r#"
//- /lib.rs crate:main
mod foo;
fn main() {
let _bar = foo::Bar { i: 0 };
}
//- /foo.rs
pub struct Bar$0 {
pub i: i32,
}
"#,
"rust-analyzer cargo main . foo/Bar#",
);
}

#[test]
fn global_symbol_for_pub_struct_reference() {
check_symbol(
r#"
//- /lib.rs crate:main
mod foo;
fn main() {
let _bar = foo::Bar$0 { i: 0 };
}
//- /foo.rs
pub struct Bar {
pub i: i32,
}
"#,
"rust-analyzer cargo main . foo/Bar#",
);
}
}