Allow languages to be registered at any time

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Max Brunsfeld 2022-02-22 10:35:20 -08:00
parent d7db3791d5
commit 64098247cb
9 changed files with 225 additions and 195 deletions

View file

@ -534,7 +534,7 @@ mod tests {
editor.read_with(&cx, |editor, cx| {
assert!(!editor.is_dirty(cx));
assert_eq!(editor.title(cx), "the-new-name.rs");
assert_eq!(editor.language(cx).unwrap().name(), "Rust");
assert_eq!(editor.language(cx).unwrap().name().as_ref(), "Rust");
});
// Edit the file and save it again. This time, there is no filename prompt.
@ -614,7 +614,7 @@ mod tests {
// The buffer is not dirty anymore and the language is assigned based on the path.
editor.read_with(&cx, |editor, cx| {
assert!(!editor.is_dirty(cx));
assert_eq!(editor.language(cx).unwrap().name(), "Rust")
assert_eq!(editor.language(cx).unwrap().name().as_ref(), "Rust")
});
}