on master help sign in
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.

commitc6bd105484fbaf35812dddc41b8fb32cb054fc54 authorMichael Davis <mcarsondavis@gmail.com> dateWed 16 Mar 2022, 04:26 (5 years ago) parent20a132e
1 file changed+4−4
helix-loader/src/grammar.rs+4−4
helix-loader/src/grammar.rs+4−4
@@ -27,8 +27,8 @@ struct Configuration {
2727#[derive(Debug, Serialize, Deserialize)]
2828#[serde(rename_all = "lowercase", untagged)]
2929pub enum GrammarSelection {
30− Only(HashSet<String>),
31− Except(HashSet<String>),
30+ Only { only: HashSet<String> },
31+ Except { except: HashSet<String> },
3232}
3333
3434#[derive(Debug, Serialize, Deserialize)]
@@ -97,12 +97,12 @@ fn get_grammar_configs() -> Result<Vec<GrammarConfiguration>> {
9797 .try_into()?;
9898
9999 let grammars = match config.grammar_selection {
100− Some(GrammarSelection::Only(selections)) => config
100+ Some(GrammarSelection::Only { only: selections }) => config
101101 .grammar
102102 .into_iter()
103103 .filter(|grammar| selections.contains(&grammar.grammar_id))
104104 .collect(),
105− Some(GrammarSelection::Except(rejections)) => config
105+ Some(GrammarSelection::Except { except: rejections }) => config
106106 .grammar
107107 .into_iter()
108108 .filter(|grammar| !rejections.contains(&grammar.grammar_id))