Adjust disk-based diagnostics based on edits since the last save

Still need to add tests... not sure if this is right yet.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo 2021-10-27 18:58:07 -06:00
parent 0c10d6c82d
commit 9977248926
3 changed files with 45 additions and 8 deletions

View file

@ -3,7 +3,7 @@ use anyhow::Result;
use gpui::AppContext;
use parking_lot::Mutex;
use serde::Deserialize;
use std::{path::Path, str, sync::Arc};
use std::{collections::HashSet, path::Path, str, sync::Arc};
use theme::SyntaxTheme;
use tree_sitter::{Language as Grammar, Query};
pub use tree_sitter::{Parser, Tree};
@ -19,7 +19,7 @@ pub struct LanguageConfig {
#[derive(Deserialize)]
pub struct LanguageServerConfig {
pub binary: String,
pub disk_based_diagnostic_sources: Vec<String>,
pub disk_based_diagnostic_sources: HashSet<String>,
}
#[derive(Clone, Debug, Deserialize)]
@ -130,11 +130,11 @@ impl Language {
}
}
pub fn disk_based_diagnostic_sources(&self) -> &[String] {
pub fn disk_based_diagnostic_sources(&self) -> Option<&HashSet<String>> {
self.config
.language_server
.as_ref()
.map_or(&[], |config| &config.disk_based_diagnostic_sources)
.map(|config| &config.disk_based_diagnostic_sources)
}
pub fn brackets(&self) -> &[BracketPair] {