Add a test demonstrating ERB language loading bug (#32278)
Fixes https://github.com/zed-industries/zed/issues/12174 Release Notes: - Fixed a bug where ERB files were not parsed correctly when the languages were initially loaded.
This commit is contained in:
parent
ad206a6a97
commit
72de3143c8
4 changed files with 145 additions and 18 deletions
|
@ -39,7 +39,7 @@ use util::{ResultExt, maybe, post_inc};
|
|||
#[derive(
|
||||
Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema,
|
||||
)]
|
||||
pub struct LanguageName(SharedString);
|
||||
pub struct LanguageName(pub SharedString);
|
||||
|
||||
impl LanguageName {
|
||||
pub fn new(s: &str) -> Self {
|
||||
|
@ -1000,6 +1000,7 @@ impl LanguageRegistry {
|
|||
txs.push(tx);
|
||||
}
|
||||
AvailableGrammar::Unloaded(wasm_path) => {
|
||||
log::trace!("start loading grammar {name:?}");
|
||||
let this = self.clone();
|
||||
let wasm_path = wasm_path.clone();
|
||||
*grammar = AvailableGrammar::Loading(wasm_path.clone(), vec![tx]);
|
||||
|
@ -1025,6 +1026,7 @@ impl LanguageRegistry {
|
|||
Err(error) => AvailableGrammar::LoadFailed(error.clone()),
|
||||
};
|
||||
|
||||
log::trace!("finish loading grammar {name:?}");
|
||||
let old_value = this.state.write().grammars.insert(name, value);
|
||||
if let Some(AvailableGrammar::Loading(_, txs)) = old_value {
|
||||
for tx in txs {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue