diff options
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/hover.rs | 63 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 3 | ||||
-rw-r--r-- | crates/ide/src/typing.rs | 3 |
3 files changed, 69 insertions, 0 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 5f9edb476..28e2e17dc 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -3834,4 +3834,67 @@ fn foo() {} | |||
3834 | "#]], | 3834 | "#]], |
3835 | ); | 3835 | ); |
3836 | } | 3836 | } |
3837 | |||
3838 | #[test] | ||
3839 | fn hover_generic_assoc() { | ||
3840 | check( | ||
3841 | r#" | ||
3842 | fn foo<T: A>() where T::Assoc$0: {} | ||
3843 | |||
3844 | trait A { | ||
3845 | type Assoc; | ||
3846 | }"#, | ||
3847 | expect![[r#" | ||
3848 | *Assoc* | ||
3849 | |||
3850 | ```rust | ||
3851 | test | ||
3852 | ``` | ||
3853 | |||
3854 | ```rust | ||
3855 | type Assoc | ||
3856 | ``` | ||
3857 | "#]], | ||
3858 | ); | ||
3859 | check( | ||
3860 | r#" | ||
3861 | fn foo<T: A>() { | ||
3862 | let _: <T>::Assoc$0; | ||
3863 | } | ||
3864 | |||
3865 | trait A { | ||
3866 | type Assoc; | ||
3867 | }"#, | ||
3868 | expect![[r#" | ||
3869 | *Assoc* | ||
3870 | |||
3871 | ```rust | ||
3872 | test | ||
3873 | ``` | ||
3874 | |||
3875 | ```rust | ||
3876 | type Assoc | ||
3877 | ``` | ||
3878 | "#]], | ||
3879 | ); | ||
3880 | check( | ||
3881 | r#" | ||
3882 | trait A where | ||
3883 | Self::Assoc$0: , | ||
3884 | { | ||
3885 | type Assoc; | ||
3886 | }"#, | ||
3887 | expect![[r#" | ||
3888 | *Assoc* | ||
3889 | |||
3890 | ```rust | ||
3891 | test | ||
3892 | ``` | ||
3893 | |||
3894 | ```rust | ||
3895 | type Assoc | ||
3896 | ``` | ||
3897 | "#]], | ||
3898 | ); | ||
3899 | } | ||
3837 | } | 3900 | } |
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 67a10766b..9df8d21af 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -48,6 +48,9 @@ pub struct HlRange { | |||
48 | // | 48 | // |
49 | // The general rule is that a reference to an entity gets colored the same way as the entity itself. | 49 | // The general rule is that a reference to an entity gets colored the same way as the entity itself. |
50 | // We also give special modifier for `mut` and `&mut` local variables. | 50 | // We also give special modifier for `mut` and `&mut` local variables. |
51 | // | ||
52 | // image::https://user-images.githubusercontent.com/48062697/113164457-06cfb980-9239-11eb-819b-0f93e646acf8.png[] | ||
53 | // image::https://user-images.githubusercontent.com/48062697/113187625-f7f50100-9250-11eb-825e-91c58f236071.png[] | ||
51 | pub(crate) fn highlight( | 54 | pub(crate) fn highlight( |
52 | db: &RootDatabase, | 55 | db: &RootDatabase, |
53 | file_id: FileId, | 56 | file_id: FileId, |
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs index e10b7d98e..11408d445 100644 --- a/crates/ide/src/typing.rs +++ b/crates/ide/src/typing.rs | |||
@@ -49,6 +49,9 @@ pub(crate) const TRIGGER_CHARS: &str = ".=>"; | |||
49 | // ---- | 49 | // ---- |
50 | // "editor.formatOnType": true, | 50 | // "editor.formatOnType": true, |
51 | // ---- | 51 | // ---- |
52 | // | ||
53 | // image::https://user-images.githubusercontent.com/48062697/113166163-69758500-923a-11eb-81ee-eb33ec380399.gif[] | ||
54 | // image::https://user-images.githubusercontent.com/48062697/113171066-105c2000-923f-11eb-87ab-f4a263346567.gif[] | ||
52 | pub(crate) fn on_char_typed( | 55 | pub(crate) fn on_char_typed( |
53 | db: &RootDatabase, | 56 | db: &RootDatabase, |
54 | position: FilePosition, | 57 | position: FilePosition, |