From c6bd105484fbaf35812dddc41b8fb32cb054fc54 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 16 Mar 2022 04:26:22 -0500 Subject: fix enum definition for use-grammars selections (#1818) See https://github.com/helix-editor/helix/discussions/1817 It looks like we need the enums to have the `only`/`except` fields in order to deserialize correctly.--- helix-loader/src/grammar.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'helix-loader/src') diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index 378e4203..299a06bf 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -27,8 +27,8 @@ struct Configuration { #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "lowercase", untagged)] pub enum GrammarSelection { - Only(HashSet), - Except(HashSet), + Only { only: HashSet }, + Except { except: HashSet }, } #[derive(Debug, Serialize, Deserialize)] @@ -97,12 +97,12 @@ fn get_grammar_configs() -> Result> { .try_into()?; let grammars = match config.grammar_selection { - Some(GrammarSelection::Only(selections)) => config + Some(GrammarSelection::Only { only: selections }) => config .grammar .into_iter() .filter(|grammar| selections.contains(&grammar.grammar_id)) .collect(), - Some(GrammarSelection::Except(rejections)) => config + Some(GrammarSelection::Except { except: rejections }) => config .grammar .into_iter() .filter(|grammar| !rejections.contains(&grammar.grammar_id)) -- cgit v1.2.3-70-g09d2