Upgrade toml to v0.8 (#7931)

This PR upgrades our `toml` dependency to v0.8.

I noticed that our current version of `toml` wasn't able to parse
certain kinds of documents involving enums, whereas the newer version
can.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-02-16 17:43:40 -05:00 committed by GitHub
parent f82b2741cd
commit 3cbc18895a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 72 additions and 22 deletions

View file

@ -415,8 +415,8 @@ impl ExtensionStore {
language.matcher.clone(),
vec![],
move || {
let config = std::fs::read(language_path.join("config.toml"))?;
let config: LanguageConfig = ::toml::from_slice(&config)?;
let config = std::fs::read_to_string(language_path.join("config.toml"))?;
let config: LanguageConfig = ::toml::from_str(&config)?;
let queries = load_plugin_queries(&language_path);
Ok((config, queries))
},

View file

@ -337,13 +337,17 @@ pub async fn language(
}
fn load_config(name: &str) -> LanguageConfig {
::toml::from_slice(
&LanguageDir::get(&format!("{}/config.toml", name))
let config_toml = String::from_utf8(
LanguageDir::get(&format!("{}/config.toml", name))
.unwrap()
.data,
.data
.to_vec(),
)
.with_context(|| format!("failed to load config.toml for language {name:?}"))
.unwrap()
.unwrap();
::toml::from_str(&config_toml)
.with_context(|| format!("failed to load config.toml for language {name:?}"))
.unwrap()
}
fn load_queries(name: &str) -> LanguageQueries {