mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Add rustdocs
This commit is contained in:
parent
c8cad76d25
commit
37aa68f050
2 changed files with 4 additions and 1 deletions
|
@ -22,6 +22,7 @@ use crate::InFile;
|
||||||
|
|
||||||
pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static {
|
pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static {
|
||||||
fn message(&self) -> String;
|
fn message(&self) -> String;
|
||||||
|
/// A presentation source of the diagnostics, to use in highlighting and similar actions
|
||||||
fn presentation(&self) -> InFile<SyntaxNodePtr>;
|
fn presentation(&self) -> InFile<SyntaxNodePtr>;
|
||||||
fn as_any(&self) -> &(dyn Any + Send + 'static);
|
fn as_any(&self) -> &(dyn Any + Send + 'static);
|
||||||
fn is_experimental(&self) -> bool {
|
fn is_experimental(&self) -> bool {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//! Provides a way to derive fixes based on the diagnostic data.
|
||||||
use crate::Fix;
|
use crate::Fix;
|
||||||
use ast::{edit::IndentLevel, make};
|
use ast::{edit::IndentLevel, make};
|
||||||
use hir::{
|
use hir::{
|
||||||
|
@ -13,8 +14,9 @@ use ra_ide_db::{
|
||||||
use ra_syntax::{algo, ast, AstNode, TextRange};
|
use ra_syntax::{algo, ast, AstNode, TextRange};
|
||||||
use ra_text_edit::{TextEdit, TextEditBuilder};
|
use ra_text_edit::{TextEdit, TextEditBuilder};
|
||||||
|
|
||||||
// TODO kb
|
/// A trait to implement fot the Diagnostic that has a fix available.
|
||||||
pub trait DiagnosticWithFix {
|
pub trait DiagnosticWithFix {
|
||||||
|
/// Provides a fix with the fix range, if applicable in the current semantics.
|
||||||
fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<(Fix, TextRange)>;
|
fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<(Fix, TextRange)>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue