Rip out "diagnostic providers"

This commit is contained in:
Antonio Scandurra 2022-01-04 16:11:29 +01:00
parent 496066db59
commit 508b9dc024
16 changed files with 267 additions and 688 deletions

View file

@ -6,10 +6,9 @@ pub mod proto;
mod tests;
use anyhow::{anyhow, Result};
use async_trait::async_trait;
pub use buffer::Operation;
pub use buffer::*;
use collections::{HashMap, HashSet};
use collections::HashSet;
pub use diagnostic_set::DiagnosticEntry;
use gpui::AppContext;
use highlight_map::HighlightMap;
@ -60,18 +59,9 @@ pub struct BracketPair {
pub newline: bool,
}
#[async_trait]
pub trait DiagnosticProvider: 'static + Send + Sync {
async fn diagnose(
&self,
path: Arc<Path>,
) -> Result<HashMap<Arc<Path>, Vec<DiagnosticEntry<usize>>>>;
}
pub struct Language {
pub(crate) config: LanguageConfig,
pub(crate) grammar: Option<Arc<Grammar>>,
pub(crate) diagnostic_provider: Option<Arc<dyn DiagnosticProvider>>,
}
pub struct Grammar {
@ -136,7 +126,6 @@ impl Language {
highlight_map: Default::default(),
})
}),
diagnostic_provider: None,
}
}
@ -170,11 +159,6 @@ impl Language {
Ok(self)
}
pub fn with_diagnostic_provider(mut self, source: impl DiagnosticProvider) -> Self {
self.diagnostic_provider = Some(Arc::new(source));
self
}
pub fn name(&self) -> &str {
self.config.name.as_str()
}
@ -208,10 +192,6 @@ impl Language {
}
}
pub fn diagnostic_provider(&self) -> Option<&Arc<dyn DiagnosticProvider>> {
self.diagnostic_provider.as_ref()
}
pub fn disk_based_diagnostic_sources(&self) -> Option<&HashSet<String>> {
self.config
.language_server