I am deveoping a simple mode for a grammar in which all lines starting with the word bank should have indent level 0, and all following lines should have indent level 1. Example:
initial lines
with no indentation
bank foo
this gets indented
this as well
bank this not
this yes
bank
foobar
…so I set indent: true on the token rule for bank, which indents all following lines. But when we get to the next line starting with bank, that line itself is still indented (from the previous bank), so I would like it to automatically get dedented. However, setting dedent: true only works when I don’t use indent: true.
I tried to fix this using electricInput. However, the way electricInput is implemented, even if the regex matches, the event only fires if smart-indent on that line changes the indentation (which it doesn’t). How do I get the correct behavior?