Extract Ocaml language support into an extension (#10450)

Release Notes:

- Extracted Ocaml language support into an extension

---------

Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-04-11 15:20:19 -07:00 committed by GitHub
parent f6c85b28d5
commit 8d7f5eab79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 289 additions and 343 deletions

View file

@ -1,11 +1,14 @@
use crate::language_settings::{AllLanguageSettingsContent, LanguageSettingsContent};
use crate::{
language_settings::all_language_settings, task_context::ContextProvider, CachedLspAdapter,
File, Language, LanguageConfig, LanguageId, LanguageMatcher, LanguageServerName, LspAdapter,
LspAdapterDelegate, PARSER, PLAIN_TEXT,
language_settings::{
all_language_settings, AllLanguageSettingsContent, LanguageSettingsContent,
},
task_context::ContextProvider,
CachedLspAdapter, File, Language, LanguageConfig, LanguageId, LanguageMatcher,
LanguageServerName, LspAdapter, LspAdapterDelegate, PARSER, PLAIN_TEXT,
};
use anyhow::{anyhow, Context as _, Result};
use collections::{hash_map, HashMap};
use futures::TryFutureExt;
use futures::{
channel::{mpsc, oneshot},
future::Shared,
@ -454,11 +457,12 @@ impl LanguageRegistry {
)
}
pub fn language_for_file_path(
pub fn language_for_file_path<'a>(
self: &Arc<Self>,
path: &Path,
) -> impl Future<Output = Result<Arc<Language>>> {
path: &'a Path,
) -> impl Future<Output = Result<Arc<Language>>> + 'a {
self.language_for_file_internal(path, None, None)
.map_err(|error| error.context(format!("language for file path {}", path.display())))
}
fn language_for_file_internal(