Continue indentation in multiline dictionary, array or tuple #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Following the update in this commit and this discussion; here is a suggested PR to continue indentation in dictionary, array or tuple blocks.
Currently when you hit return to create an array, dictionary or tuple block the cursor maintains the base indentation:
This PR adds
TupleExpression: continuedIndent(),DictionaryExpression: continuedIndent()andArrayExpression: continuedIndent()toindentNodePropwhich gives the following experience:Good idea! Not sure why those aren't there yet. I think
delimitedIndentis a better match for these though, since it allows the end bracket to be deindented (as in your examples), and supports 'aligned' indentation when elements start on the line of the opening bracket.Ahh thanks, @marijnh, I wasn't 100% sure which was the best method to use. Updated accordingly 👍
Thanks!
These aren't compiling for me.
I think they're missing a value for
closing.https://github.com/codemirror/language/blob/main/src/indent.ts#L264
Compare with:
https://github.com/codemirror/lang-javascript/blob/main/src/javascript.ts#L23
Interestingly the
./bin/cm.js buildcompletes just fine but the demo doesn't work if I switch it to use lang-python.Indeed, that patch never typechecked.
18462e7347should fix it.Apologies for missing that gents. And thanks @marijnh for fixing! 🙌