aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/semantics.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index e392130ab..1c5dc3d51 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -145,6 +145,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
145 self.imp.original_range(node) 145 self.imp.original_range(node)
146 } 146 }
147 147
148 pub fn diagnostics_fix_range(&self, diagnostics: &dyn Diagnostic) -> FileRange {
149 self.imp.diagnostics_fix_range(diagnostics)
150 }
151
148 pub fn diagnostics_range(&self, diagnostics: &dyn Diagnostic) -> FileRange { 152 pub fn diagnostics_range(&self, diagnostics: &dyn Diagnostic) -> FileRange {
149 self.imp.diagnostics_range(diagnostics) 153 self.imp.diagnostics_range(diagnostics)
150 } 154 }
@@ -376,6 +380,13 @@ impl<'db> SemanticsImpl<'db> {
376 original_range(self.db, node.as_ref()) 380 original_range(self.db, node.as_ref())
377 } 381 }
378 382
383 fn diagnostics_fix_range(&self, diagnostics: &dyn Diagnostic) -> FileRange {
384 let src = diagnostics.fix_source();
385 let root = self.db.parse_or_expand(src.file_id).unwrap();
386 let node = src.value.to_node(&root);
387 original_range(self.db, src.with_value(&node))
388 }
389
379 fn diagnostics_range(&self, diagnostics: &dyn Diagnostic) -> FileRange { 390 fn diagnostics_range(&self, diagnostics: &dyn Diagnostic) -> FileRange {
380 let src = diagnostics.source(); 391 let src = diagnostics.source();
381 let root = self.db.parse_or_expand(src.file_id).unwrap(); 392 let root = self.db.parse_or_expand(src.file_id).unwrap();