suggested extensions (#9526)

Follow-up from #9138

Release Notes:

- Adds suggested extensions for some filetypes
([#7096](https://github.com/zed-industries/zed/issues/7096)).

---------

Co-authored-by: Felix Zeller <felixazeller@gmail.com>
This commit is contained in:
Conrad Irwin 2024-03-19 10:06:01 -06:00 committed by GitHub
parent 7573f35e8e
commit d6b7f14b51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 318 additions and 37 deletions

View file

@ -62,8 +62,8 @@ pub use buffer::Operation;
pub use buffer::*;
pub use diagnostic_set::DiagnosticEntry;
pub use language_registry::{
LanguageQueries, LanguageRegistry, LanguageServerBinaryStatus, PendingLanguageServer,
QUERY_FILENAME_PREFIXES,
LanguageNotFound, LanguageQueries, LanguageRegistry, LanguageServerBinaryStatus,
PendingLanguageServer, QUERY_FILENAME_PREFIXES,
};
pub use lsp::LanguageServerId;
pub use outline::{Outline, OutlineItem};

View file

@ -85,6 +85,15 @@ enum AvailableGrammar {
Unloaded(PathBuf),
}
#[derive(Debug)]
pub struct LanguageNotFound;
impl std::fmt::Display for LanguageNotFound {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "language not found")
}
}
pub const QUERY_FILENAME_PREFIXES: &[(
&str,
fn(&mut LanguageQueries) -> &mut Option<Cow<'static, str>>,
@ -471,7 +480,7 @@ impl LanguageRegistry {
.max_by_key(|e| e.1)
.clone()
else {
let _ = tx.send(Err(anyhow!("language not found")));
let _ = tx.send(Err(anyhow!(LanguageNotFound)));
return rx;
};