language: Refactor available_languages into its own struct (#61388)

This adds a dedicated `AvailableLanguages` struct in preparation for a
more cabable language matching based on a given language config. No
functional changes, just shuffling some code around for this round.

Also made the LanguageMatcher non-cloneable in favor of wrapping it in
an Arc, since cloning is rather expensive for this and having a
reference is sufficient in all cases right now.

Release Notes:

- N/A

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
This commit is contained in:
Finn EversandBen Brandt authored and GitHub committed 2026-07-23 11:22:43 +00:00
1 parent 97b51f2620
commit 25632b979b
35 files changed
+763 -576

No files matched your search

+2 -2
View File
@@ -967,9 +967,9 @@ async fn build_buffer(
let text = Rope::from(text);
let language =
cx.update(|_, cx| language_registry.language_for_file(&blob, Some(&text), cx))?;
let language = if let Some(language) = language {
let language = if let Some(language_id) = language {
language_registry
.load_language(&language)
.load_language(language_id)
.await
.ok()
.and_then(|e| e.log_err())