aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-17 12:06:02 +0100
committerAleksey Kladov <[email protected]>2020-04-17 12:56:38 +0100
commita8196ffe8466aa60dec56e77c2da717793c0debe (patch)
tree03869b8175d5325de1baa95e0a385d2823b5946e /crates/ra_hir_ty
parent302bf97bbf1855e3c7def9ab4f9f3d338be5e3b7 (diff)
Correctly highlight ranges of diagnostics from macros
closes #2799
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index da85bd082..018c2ad3f 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -21,12 +21,12 @@ impl Diagnostic for NoSuchField {
21 "no such field".to_string() 21 "no such field".to_string()
22 } 22 }
23 23
24 fn highlight_range(&self) -> TextRange { 24 fn highlight_range(&self) -> InFile<TextRange> {
25 self.highlight_range 25 InFile::new(self.file, self.highlight_range)
26 } 26 }
27 27
28 fn source(&self) -> InFile<SyntaxNodePtr> { 28 fn source(&self) -> InFile<SyntaxNodePtr> {
29 InFile { file_id: self.file, value: self.field.clone().into() } 29 InFile::new(self.file, self.field.clone().into())
30 } 30 }
31 31
32 fn as_any(&self) -> &(dyn Any + Send + 'static) { 32 fn as_any(&self) -> &(dyn Any + Send + 'static) {
@@ -50,8 +50,8 @@ impl Diagnostic for MissingFields {
50 } 50 }
51 buf 51 buf
52 } 52 }
53 fn highlight_range(&self) -> TextRange { 53 fn highlight_range(&self) -> InFile<TextRange> {
54 self.highlight_range 54 InFile::new(self.file, self.highlight_range)
55 } 55 }
56 56
57 fn source(&self) -> InFile<SyntaxNodePtr> { 57 fn source(&self) -> InFile<SyntaxNodePtr> {
@@ -88,8 +88,8 @@ impl Diagnostic for MissingPatFields {
88 } 88 }
89 buf 89 buf
90 } 90 }
91 fn highlight_range(&self) -> TextRange { 91 fn highlight_range(&self) -> InFile<TextRange> {
92 self.highlight_range 92 InFile::new(self.file, self.highlight_range)
93 } 93 }
94 fn source(&self) -> InFile<SyntaxNodePtr> { 94 fn source(&self) -> InFile<SyntaxNodePtr> {
95 InFile { file_id: self.file, value: self.field_list.clone().into() } 95 InFile { file_id: self.file, value: self.field_list.clone().into() }
@@ -111,8 +111,8 @@ impl Diagnostic for MissingMatchArms {
111 fn message(&self) -> String { 111 fn message(&self) -> String {
112 String::from("Missing match arm") 112 String::from("Missing match arm")
113 } 113 }
114 fn highlight_range(&self) -> TextRange { 114 fn highlight_range(&self) -> InFile<TextRange> {
115 self.highlight_range 115 InFile::new(self.file, self.highlight_range)
116 } 116 }
117 fn source(&self) -> InFile<SyntaxNodePtr> { 117 fn source(&self) -> InFile<SyntaxNodePtr> {
118 InFile { file_id: self.file, value: self.match_expr.clone().into() } 118 InFile { file_id: self.file, value: self.match_expr.clone().into() }
@@ -133,8 +133,8 @@ impl Diagnostic for MissingOkInTailExpr {
133 fn message(&self) -> String { 133 fn message(&self) -> String {
134 "wrap return expression in Ok".to_string() 134 "wrap return expression in Ok".to_string()
135 } 135 }
136 fn highlight_range(&self) -> TextRange { 136 fn highlight_range(&self) -> InFile<TextRange> {
137 self.highlight_range 137 InFile::new(self.file, self.highlight_range)
138 } 138 }
139 fn source(&self) -> InFile<SyntaxNodePtr> { 139 fn source(&self) -> InFile<SyntaxNodePtr> {
140 InFile { file_id: self.file, value: self.expr.clone().into() } 140 InFile { file_id: self.file, value: self.expr.clone().into() }