zeta2: Use bounded parallelism for tree-sitter indexing + await completion in zeta_cli (#39147)
Also skips indexing files that don't have a suffix that indicates a known language, and skips when the language doesn't have an outline grammar. Release Notes: - N/A --------- Co-authored-by: Agus <agus@zed.dev>
This commit is contained in:
@@ -731,15 +731,19 @@ impl LanguageRegistry {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn language_for_file_path<'a>(
|
||||
pub fn language_for_file_path(self: &Arc<Self>, path: &Path) -> Option<AvailableLanguage> {
|
||||
self.language_for_file_internal(path, None, None)
|
||||
}
|
||||
|
||||
pub fn load_language_for_file_path<'a>(
|
||||
self: &Arc<Self>,
|
||||
path: &'a Path,
|
||||
) -> impl Future<Output = Result<Arc<Language>>> + 'a {
|
||||
let available_language = self.language_for_file_internal(path, None, None);
|
||||
let language = self.language_for_file_path(path);
|
||||
|
||||
let this = self.clone();
|
||||
async move {
|
||||
if let Some(language) = available_language {
|
||||
if let Some(language) = language {
|
||||
this.load_language(&language).await?
|
||||
} else {
|
||||
Err(anyhow!(LanguageNotFound))
|
||||
|
||||
Reference in New Issue
Block a user