Indent in simple mode

Hi! I’m trying to implement a mode using the mode/simple addon and I’m not being able to make auto-indentation work specifically when opening parentheses (square brackets and braces work perfectly). I tried just copying the “simplemode” from the demo and still the same. I guessed that maybe one of the addons was causing the problem and found that enabling autoCloseBrackets made it show up:

// works: 
this.editor = CodeMirror( this.$refs.editor as HTMLElement, {
    value: "foobar",
    mode: "simplemode"
}

// doesn't work: 
this.editor = CodeMirror( this.$refs.editor as HTMLElement, {
    value: "foobar",
    mode: "simplemode",
    autoCloseBrackets: true
}

Any idea how to solve this? :thinking:

What you’re seeing is that the mode will align a line starting with a closing parentheses with the statement that opened the parens, and with autoclosebrackets on, you’ll have a closing parentheses after your cursor if you press ‘(’ and then enter. Indentation between parens still works as normal, if you put actual code between them and then reindent.

Thanks for the explanation Marjin! I was just gonna write for future reference that I took the fact that pressing enter after "[" or "{" added a new indented line but after "(" it didn’t as “indentation is not working”, when actually I was simply not setting the explode option of autoCloseBrackets properly (that by default is set just for "[]{}")