From 3e7472f76c70c3b0a31bb72f6f318c1aa1aba83d Mon Sep 17 00:00:00 2001 From: Aramis Razzaghipour Date: Fri, 28 May 2021 09:25:32 +1000 Subject: Add `public` semantic token modifier for public items --- .../test_data/highlight_assoc_functions.html | 8 ++--- .../test_data/highlight_doctest.html | 18 +++++----- .../test_data/highlighting.html | 42 +++++++++++++--------- 3 files changed, 38 insertions(+), 30 deletions(-) (limited to 'crates/ide/src/syntax_highlighting/test_data') diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html index 4e85f7c0b..9326d9d45 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html @@ -43,8 +43,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd struct foo {} impl foo { - pub fn is_static() {} - pub fn is_not_static(&self) {} + pub fn is_static() {} + pub fn is_not_static(&self) {} } trait t { @@ -53,7 +53,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } impl t for foo { - pub fn is_static() {} - pub fn is_not_static(&self) {} + pub fn is_static() {} + pub fn is_not_static(&self) {} } \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html index 79a285107..1f2f83a08 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html @@ -63,7 +63,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd // KILLER WHALE /// Ishmael."; /// ``` - pub const bar: bool = true; + pub const bar: bool = true; /// Constructs a new `Foo`. /// @@ -73,7 +73,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// # #![allow(unused_mut)] /// let mut foo: Foo = Foo::new(); /// ``` - pub const fn new() -> Foo { + pub const fn new() -> Foo { Foo { bar: true } } @@ -107,7 +107,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// ```sh /// echo 1 /// ``` - pub fn foo(&self) -> bool { + pub fn foo(&self) -> bool { true } } @@ -119,10 +119,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// /// [`Item`]: module::Item /// [mix_and_match]: ThisShouldntResolve -pub fn all_the_links() {} +pub fn all_the_links() {} -pub mod module { - pub struct Item; +pub mod module { + pub struct Item; } /// ``` @@ -148,7 +148,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd #[cfg_attr(not(feature = "alloc"), doc = "```ignore")] /// let _ = example(&alloc::vec![1, 2, 3]); /// ``` -pub fn mix_and_match() {} +pub fn mix_and_match() {} /** It is beyond me why you'd use these when you got /// @@ -157,7 +157,7 @@ It is beyond me why you'd use these when you got /// ``` [`block_comments2`] tests these with indentation */ -pub fn block_comments() {} +pub fn block_comments() {} /** Really, I don't get it @@ -166,4 +166,4 @@ It is beyond me why you'd use these when you got /// ``` [`block_comments`] tests these without indentation */ -pub fn block_comments2() {} \ No newline at end of file +pub fn block_comments2() {} \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 9232cf905..63daf25c6 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -45,26 +45,26 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd macro Copy {} // Needed for function consuming vs normal -pub mod marker { +pub mod marker { #[lang = "copy"] - pub trait Copy {} + pub trait Copy {} } -pub mod ops { +pub mod ops { #[lang = "fn_once"] - pub trait FnOnce<Args> {} + pub trait FnOnce<Args> {} #[lang = "fn_mut"] - pub trait FnMut<Args>: FnOnce<Args> {} + pub trait FnMut<Args>: FnOnce<Args> {} #[lang = "fn"] - pub trait Fn<Args>: FnMut<Args> {} + pub trait Fn<Args>: FnMut<Args> {} } struct Foo { - pub x: i32, - pub y: i32, + pub x: i32, + pub y: i32, } trait Bar where Self: { @@ -73,7 +73,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd impl Bar for Foo where Self: { fn bar(&self) -> i32 { - self.x + self.x } } @@ -83,11 +83,11 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } fn qux(&mut self) { - self.x = 0; + self.x = 0; } fn quop(&self) -> i32 { - self.x + self.x } } @@ -128,8 +128,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd FOO } -use ops::Fn; -fn baz<F: Fn() -> ()>(f: F) { +use ops::Fn; +fn baz<F: Fn() -> ()>(f: F) { f() } @@ -181,7 +181,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd let mut vec = Vec::new(); if true { let x = 92; - vec.push(Foo { x, y: 1 }); + vec.push(Foo { x, y: 1 }); } unsafe { vec.set_len(0); @@ -198,12 +198,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd let y = &mut x; let z = &y; - let Foo { x: z, y } = Foo { x: z, y }; + let Foo { x: z, y } = Foo { x: z, y }; y; - let mut foo = Foo { x, y: x }; - let foo2 = Foo { x, y: x }; + let mut foo = Foo { x, y: x }; + let foo2 = Foo { x, y: x }; foo.quop(); foo.qux(); foo.baz(foo2); @@ -269,5 +269,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } } +pub enum Bool { True, False } + +impl Bool { + pub const fn to_primitive(self) -> bool { + matches!(self, Self::True) + } +} +const USAGE_OF_BOOL:bool = Bool::True.to_primitive(); \ No newline at end of file -- cgit v1.2.3