Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/hir_expand/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! `DiagnosticSink` struct is used as an emitter for diagnostic. When creating
//! a `DiagnosticSink`, you supply a callback which can react to a `dyn
//! Diagnostic` or to any concrete diagnostic (downcasting is sued internally).
//! Diagnostic` or to any concrete diagnostic (downcasting is used internally).
//!
//! Because diagnostics store file offsets, it's a bad idea to store them
//! directly in salsa. For this reason, every hir subsytem defines it's own
Expand All @@ -32,7 +32,12 @@ impl DiagnosticCode {
pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static {
fn code(&self) -> DiagnosticCode;
fn message(&self) -> String;
/// Used in highlighting and related purposes
/// Source element that triggered the diagnostics.
///
/// Note that this should reflect "semantics", rather than specific span we
/// want to highlight. When rendering the diagnostics into an error message,
/// the IDE will fetch the `SyntaxNode` and will narrow the span
/// appropriately.
fn display_source(&self) -> InFile<SyntaxNodePtr>;
fn as_any(&self) -> &(dyn Any + Send + 'static);
fn is_experimental(&self) -> bool {
Expand Down