Merge branch 'main' of github.com:zed-industries/zed into vector_store
This commit is contained in:
commit
297fa029e3
7 changed files with 47 additions and 41 deletions
|
@ -90,8 +90,7 @@ pub struct LanguageServerName(pub Arc<str>);
|
|||
/// once at startup, and caches the results.
|
||||
pub struct CachedLspAdapter {
|
||||
pub name: LanguageServerName,
|
||||
initialization_options: Option<Value>,
|
||||
initialization_overrides: Mutex<Option<Value>>,
|
||||
pub initialization_options: Option<Value>,
|
||||
pub disk_based_diagnostic_sources: Vec<String>,
|
||||
pub disk_based_diagnostics_progress_token: Option<String>,
|
||||
pub language_ids: HashMap<String, String>,
|
||||
|
@ -110,7 +109,6 @@ impl CachedLspAdapter {
|
|||
Arc::new(CachedLspAdapter {
|
||||
name,
|
||||
initialization_options,
|
||||
initialization_overrides: Mutex::new(None),
|
||||
disk_based_diagnostic_sources,
|
||||
disk_based_diagnostics_progress_token,
|
||||
language_ids,
|
||||
|
@ -210,30 +208,6 @@ impl CachedLspAdapter {
|
|||
) -> Option<CodeLabel> {
|
||||
self.adapter.label_for_symbol(name, kind, language).await
|
||||
}
|
||||
|
||||
pub fn update_initialization_overrides(&self, new: Option<&Value>) -> bool {
|
||||
let mut current = self.initialization_overrides.lock();
|
||||
if current.as_ref() != new {
|
||||
*current = new.cloned();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn initialization_options(&self) -> Option<Value> {
|
||||
let initialization_options = self.initialization_options.as_ref();
|
||||
let override_options = self.initialization_overrides.lock().clone();
|
||||
match (initialization_options, override_options) {
|
||||
(None, override_options) => override_options,
|
||||
(initialization_options, None) => initialization_options.cloned(),
|
||||
(Some(initialization_options), Some(override_options)) => {
|
||||
let mut initialization_options = initialization_options.clone();
|
||||
merge_json_value_into(override_options, &mut initialization_options);
|
||||
Some(initialization_options)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait LspAdapterDelegate: Send + Sync {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue