aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/hover.rs29
-rw-r--r--crates/ide/src/join_lines.rs2
-rw-r--r--crates/ide/src/references.rs3
-rw-r--r--crates/ide/src/syntax_highlighting.rs4
4 files changed, 21 insertions, 17 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 529cf5f33..409f81ca0 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -568,8 +568,6 @@ mod tests {
568 568
569 use crate::fixture; 569 use crate::fixture;
570 570
571 use super::*;
572
573 fn check_hover_no_result(ra_fixture: &str) { 571 fn check_hover_no_result(ra_fixture: &str) {
574 let (analysis, position) = fixture::position(ra_fixture); 572 let (analysis, position) = fixture::position(ra_fixture);
575 assert!(analysis.hover(position, true, true).unwrap().is_none()); 573 assert!(analysis.hover(position, true, true).unwrap().is_none());
@@ -3016,8 +3014,8 @@ fn foo() {
3016 file_id: FileId( 3014 file_id: FileId(
3017 1, 3015 1,
3018 ), 3016 ),
3019 full_range: 245..427, 3017 full_range: 248..430,
3020 focus_range: 284..290, 3018 focus_range: 287..293,
3021 name: "Future", 3019 name: "Future",
3022 kind: Trait, 3020 kind: Trait,
3023 description: "pub trait Future", 3021 description: "pub trait Future",
@@ -3813,11 +3811,14 @@ use foo::bar::{self$0};
3813 3811
3814 #[test] 3812 #[test]
3815 fn hover_keyword() { 3813 fn hover_keyword() {
3816 let ra_fixture = r#"//- /main.rs crate:main deps:std
3817fn f() { retur$0n; }"#;
3818 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3819 check( 3814 check(
3820 &fixture, 3815 r#"
3816//- /main.rs crate:main deps:std
3817fn f() { retur$0n; }
3818//- /libstd.rs crate:std
3819/// Docs for return_keyword
3820mod return_keyword {}
3821"#,
3821 expect![[r#" 3822 expect![[r#"
3822 *return* 3823 *return*
3823 3824
@@ -3834,11 +3835,15 @@ fn f() { retur$0n; }"#;
3834 3835
3835 #[test] 3836 #[test]
3836 fn hover_builtin() { 3837 fn hover_builtin() {
3837 let ra_fixture = r#"//- /main.rs crate:main deps:std
3838cosnt _: &str$0 = ""; }"#;
3839 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3840 check( 3838 check(
3841 &fixture, 3839 r#"
3840//- /main.rs crate:main deps:std
3841cosnt _: &str$0 = ""; }
3842
3843//- /libstd.rs crate:std
3844/// Docs for prim_str
3845mod prim_str {}
3846"#,
3842 expect![[r#" 3847 expect![[r#"
3843 *str* 3848 *str*
3844 3849
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs
index 93d3760bf..ffa8bd182 100644
--- a/crates/ide/src/join_lines.rs
+++ b/crates/ide/src/join_lines.rs
@@ -197,7 +197,7 @@ fn join_single_use_tree(edit: &mut TextEditBuilder, token: &SyntaxToken) -> Opti
197} 197}
198 198
199fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { 199fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool {
200 matches!((left, right), (T![,], T![')']) | (T![,], T![']'])) 200 matches!((left, right), (T![,], T![')'] | T![']']))
201} 201}
202 202
203fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str { 203fn compute_ws(left: SyntaxKind, right: SyntaxKind) -> &'static str {
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index 945c9b9e1..5808562a7 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -79,8 +79,7 @@ pub(crate) fn find_all_refs(
79 }); 79 });
80 usages.references.retain(|_, it| !it.is_empty()); 80 usages.references.retain(|_, it| !it.is_empty());
81 } 81 }
82 Definition::ModuleDef(hir::ModuleDef::Adt(_)) 82 Definition::ModuleDef(hir::ModuleDef::Adt(_) | hir::ModuleDef::Variant(_)) => {
83 | Definition::ModuleDef(hir::ModuleDef::Variant(_)) => {
84 refs.for_each(|it| { 83 refs.for_each(|it| {
85 it.retain(|reference| { 84 it.retain(|reference| {
86 reference.name.as_name_ref().map_or(false, is_lit_name_ref) 85 reference.name.as_name_ref().map_or(false, is_lit_name_ref)
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs
index e186b82b7..d44a1b45f 100644
--- a/crates/ide/src/syntax_highlighting.rs
+++ b/crates/ide/src/syntax_highlighting.rs
@@ -294,7 +294,7 @@ fn traverse(
294 Some(parent) => { 294 Some(parent) => {
295 // We only care Name and Name_ref 295 // We only care Name and Name_ref
296 match (token.kind(), parent.kind()) { 296 match (token.kind(), parent.kind()) {
297 (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), 297 (IDENT, NAME | NAME_REF) => parent.into(),
298 _ => token.into(), 298 _ => token.into(),
299 } 299 }
300 } 300 }
@@ -310,7 +310,7 @@ fn traverse(
310 Some(parent) => { 310 Some(parent) => {
311 // We only care Name and Name_ref 311 // We only care Name and Name_ref
312 match (token.kind(), parent.kind()) { 312 match (token.kind(), parent.kind()) {
313 (IDENT, NAME) | (IDENT, NAME_REF) => parent.into(), 313 (IDENT, NAME | NAME_REF) => parent.into(),
314 _ => token.into(), 314 _ => token.into(),
315 } 315 }
316 } 316 }