Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-core/src/diagnostic.rs')
| -rw-r--r-- | helix-core/src/diagnostic.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs index 52d77a9a..d41119d3 100644 --- a/helix-core/src/diagnostic.rs +++ b/helix-core/src/diagnostic.rs @@ -1,4 +1,6 @@ //! LSP diagnostic utility types. +use std::fmt; + use serde::{Deserialize, Serialize}; /// Describes the severity level of a [`Diagnostic`]. @@ -47,8 +49,25 @@ pub struct Diagnostic { pub message: String, pub severity: Option<Severity>, pub code: Option<NumberOrString>, - pub language_server_id: usize, + pub provider: DiagnosticProvider, pub tags: Vec<DiagnosticTag>, pub source: Option<String>, pub data: Option<serde_json::Value>, } + +// TODO turn this into an enum + feature flag when lsp becomes optional +pub type DiagnosticProvider = LanguageServerId; + +// while I would prefer having this in helix-lsp that necessitates a bunch of +// conversions I would rather not add. I think its fine since this just a very +// trivial newtype wrapper and we would need something similar once we define +// completions in core +slotmap::new_key_type! { + pub struct LanguageServerId; +} + +impl fmt::Display for LanguageServerId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{:?}", self.0) + } +} |