From 2b200f6e1a600e263f314efba5d8c3743095071b Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sat, 25 May 2019 16:29:39 +0200 Subject: Disable broken struct field rainbowing --- crates/ra_ide_api/src/lib.rs | 6 +++--- crates/ra_ide_api/src/snapshots/highlighting.html | 6 +++--- crates/ra_ide_api/src/syntax_highlighting.rs | 18 +----------------- 3 files changed, 7 insertions(+), 23 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 65a3b591a..452407e8e 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -463,8 +463,8 @@ impl Analysis { } /// Computes syntax highlighting for the given file. - pub fn highlight_as_html(&self, file_id: FileId) -> Cancelable { - self.with_db(|db| syntax_highlighting::highlight_as_html(db, file_id, true)) + pub fn highlight_as_html(&self, file_id: FileId, rainbow: bool) -> Cancelable { + self.with_db(|db| syntax_highlighting::highlight_as_html(db, file_id, rainbow)) } /// Computes completions at the given position. @@ -472,7 +472,7 @@ impl Analysis { self.with_db(|db| completion::completions(db, position).map(Into::into)) } - /// Computes assists (aks code actons aka intentions) for the given + /// Computes assists (aka code actions aka intentions) for the given /// position. pub fn assists(&self, frange: FileRange) -> Cancelable> { self.with_db(|db| assists::assists(db, frange)) diff --git a/crates/ra_ide_api/src/snapshots/highlighting.html b/crates/ra_ide_api/src/snapshots/highlighting.html index 4f4ed62a1..ebd187a35 100644 --- a/crates/ra_ide_api/src/snapshots/highlighting.html +++ b/crates/ra_ide_api/src/snapshots/highlighting.html @@ -19,8 +19,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4e
#[derive(Clone, Debug)]
 struct Foo {
-    pub x: i32,
-    pub y: i32,
+    pub x: i32,
+    pub y: i32,
 }
 
 fn foo<T>() -> T {
@@ -33,7 +33,7 @@ pre        { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4e
 
     let mut vec = Vec::new();
     if true {
-        vec.push(Foo { x: 0, y: 1 });
+        vec.push(Foo { x: 0, y: 1 });
     }
     unsafe { vec.set_len(0); }
 }
\ No newline at end of file diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index 8981c85e6..e46686ab9 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs @@ -68,16 +68,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec "function", Some(Macro(_)) => "macro", - Some(FieldAccess(field)) => { - let (hir_file_id, src) = field.source(db); - if let hir::FieldSource::Named(name) = src { - let text = name.syntax().text().to_smol_string(); - let shadow_count = 0; // potentially even from different file - binding_hash = Some(calc_binding_hash(hir_file_id.original_file(db), &text, shadow_count)); - } - - "field" - }, + Some(FieldAccess(_)) => "field", Some(AssocItem(ImplItem::Method(_))) => "function", Some(AssocItem(ImplItem::Const(_))) => "constant", Some(AssocItem(ImplItem::TypeAlias(_))) => "type", @@ -119,13 +110,6 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec