File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
crates/ide/src/syntax_highlighting Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,10 @@ fn highlight_name_ref(
413413 if is_from_builtin_crate {
414414 h |= HlMod :: DefaultLibrary ;
415415 }
416+ let is_deprecated = resolved_krate. attrs ( sema. db ) . by_key ( sym:: deprecated) . exists ( ) ;
417+ if is_deprecated {
418+ h |= HlMod :: Deprecated ;
419+ }
416420 h |= HlMod :: CrateRoot ;
417421 h
418422 }
Original file line number Diff line number Diff line change 4343</ style >
4444< pre > < code > < span class ="attribute_bracket attribute "> #</ span > < span class ="attribute_bracket attribute "> !</ span > < span class ="attribute_bracket attribute "> [</ span > < span class ="builtin_attr attribute "> deprecated</ span > < span class ="attribute_bracket attribute "> ]</ span >
4545< span class ="keyword "> use</ span > < span class ="keyword crate_root deprecated public "> crate</ span > < span class ="keyword "> as</ span > < span class ="punctuation "> _</ span > < span class ="semicolon "> ;</ span >
46+ < span class ="keyword "> extern</ span > < span class ="keyword "> crate</ span > < span class ="module crate_root deprecated library "> bar</ span > < span class ="semicolon "> ;</ span >
4647< span class ="attribute_bracket attribute "> #</ span > < span class ="attribute_bracket attribute "> [</ span > < span class ="builtin_attr attribute "> deprecated</ span > < span class ="attribute_bracket attribute "> ]</ span >
4748< span class ="keyword "> macro_rules</ span > < span class ="macro_bang "> !</ span > < span class ="macro declaration deprecated public "> macro_</ span > < span class ="brace "> {</ span >
4849 < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="operator "> =</ span > < span class ="operator "> ></ span > < span class ="brace "> {</ span > < span class ="brace "> }</ span > < span class ="semicolon "> ;</ span >
6869< span class ="attribute_bracket attribute "> #</ span > < span class ="attribute_bracket attribute "> [</ span > < span class ="builtin_attr attribute "> deprecated</ span > < span class ="attribute_bracket attribute "> ]</ span >
6970< span class ="keyword "> type</ span > < span class ="type_alias declaration deprecated "> Alias</ span > < span class ="operator "> =</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="semicolon "> ;</ span >
7071< span class ="attribute_bracket attribute "> #</ span > < span class ="attribute_bracket attribute "> [</ span > < span class ="builtin_attr attribute "> deprecated</ span > < span class ="attribute_bracket attribute "> ]</ span >
71- < span class ="keyword "> static</ span > < span class ="static declaration deprecated "> STATIC</ span > < span class ="colon "> :</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="operator "> =</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="semicolon "> ;</ span > </ code > </ pre >
72+ < span class ="keyword "> static</ span > < span class ="static declaration deprecated "> STATIC</ span > < span class ="colon "> :</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="operator "> =</ span > < span class ="parenthesis "> (</ span > < span class ="parenthesis "> )</ span > < span class ="semicolon "> ;</ span >
73+ </ code > </ pre >
Original file line number Diff line number Diff line change @@ -1516,8 +1516,10 @@ fn main() {
15161516fn test_deprecated_highlighting ( ) {
15171517 check_highlighting (
15181518 r#"
1519+ //- /foo.rs crate:foo deps:bar
15191520#![deprecated]
15201521use crate as _;
1522+ extern crate bar;
15211523#[deprecated]
15221524macro_rules! macro_ {
15231525 () => {};
@@ -1544,6 +1546,8 @@ trait Trait {}
15441546type Alias = ();
15451547#[deprecated]
15461548static STATIC: () = ();
1549+ //- /bar.rs crate:bar
1550+ #![deprecated]
15471551 "# ,
15481552 expect_file ! [ "./test_data/highlight_deprecated.html" ] ,
15491553 false ,
You can’t perform that action at this time.
0 commit comments