Remove available language only when it has loaded

This also ensures that, if you load the same language more than once,
a future that resolves to the language (or an error) is returned at
all times. Previously, we would only return it the first time the language
was loaded.
This commit is contained in:
Antonio Scandurra 2023-03-16 10:28:07 +01:00
parent a8ac08f5bd
commit 4d52fc0d12
4 changed files with 111 additions and 74 deletions

View file

@ -306,7 +306,7 @@ mod tests {
let language = language(
"rust",
tree_sitter_rust::language(),
Some(Box::new(RustLspAdapter)),
Some(Arc::new(RustLspAdapter)),
)
.await;
let grammar = language.grammar().unwrap();
@ -392,7 +392,7 @@ mod tests {
let language = language(
"rust",
tree_sitter_rust::language(),
Some(Box::new(RustLspAdapter)),
Some(Arc::new(RustLspAdapter)),
)
.await;
let grammar = language.grammar().unwrap();