2021-10-26 00:02:16 +08:00
|
|
|
//! LSP diagnostic utility types.
|
|
|
|
|
|
|
|
/// Describes the severity level of a [`Diagnostic`].
|
2021-06-07 22:34:19 +08:00
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
2021-03-11 15:31:49 +08:00
|
|
|
pub enum Severity {
|
|
|
|
Error,
|
|
|
|
Warning,
|
|
|
|
Info,
|
|
|
|
Hint,
|
|
|
|
}
|
|
|
|
|
2021-10-26 00:02:16 +08:00
|
|
|
/// A range of `char`s within the text.
|
2021-06-07 22:34:19 +08:00
|
|
|
#[derive(Debug)]
|
2021-03-15 15:19:31 +08:00
|
|
|
pub struct Range {
|
|
|
|
pub start: usize,
|
|
|
|
pub end: usize,
|
|
|
|
}
|
2021-06-06 23:55:05 +08:00
|
|
|
|
2021-10-26 00:02:16 +08:00
|
|
|
/// Corresponds to [`lsp_types::Diagnostic`](https://docs.rs/lsp-types/0.91.0/lsp_types/struct.Diagnostic.html)
|
2021-06-07 22:34:19 +08:00
|
|
|
#[derive(Debug)]
|
2020-10-20 14:42:53 +08:00
|
|
|
pub struct Diagnostic {
|
2021-03-15 15:19:31 +08:00
|
|
|
pub range: Range,
|
2020-10-20 14:42:53 +08:00
|
|
|
pub line: usize,
|
|
|
|
pub message: String,
|
2021-03-11 15:31:49 +08:00
|
|
|
pub severity: Option<Severity>,
|
2020-10-20 14:42:53 +08:00
|
|
|
}
|