jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
3.18k stars 130 forks source link

Switch error should be more specific #1282

Closed jtroo closed 1 month ago

jtroo commented 1 month ago

https://github.com/jtroo/kanata/blob/d54257a9dd8bb82559637e1b9f42001ea7301bbc/parser/src/cfg/switch.rs#L140

This should probably be &l[1] in place of op_expr.

jtroo commented 1 month ago

Seems there are multiple cases of this in switch. Implication of this is that template expansions don't find the right expression when encountering errors:

  × Error in configuration
    ╭─[configuration:86:1]
 86 │   (switch 
 87 │    ((key-history $K 1)) ✗ break
    ·     ─────────┬────────
    ·              ╰── Error here
 88 │    () $K break
    ╰────
  help: invalid key name

        For more info, see the configuration guide:
        https://github.com/jtroo/kanata/blob/main/docs/config.adoc
jtroo commented 1 month ago

https://github.com/jtroo/kanata/commit/10448d8f47113d760174cafca05a96be9a3260a1