helix
helix copied to clipboard
feat(auto-pair): auto-pair triple quotes properly
closes #13697
how it used to be
''|
' ->
'''|'
how it will be
''|
' ->
'''|'''
side changes
it no longer auto-pairs if there are already >= 3 quotes before: '''| + ' -> ''''|
not affected
| -> '|'
'| -> ''|
(((| -> ((((|)
Why not just close the code fence as suggested in:
Duplicate of #4035 - ideally we should close the codefence once we reach three backticks
So when you have:
``|
Writing ` will do this:
```|```
This can also work with e.g. triple quotes in Python. So if you have:
""|
Writing " will do this:
"""|"""
I believe this behaviour will be more helpful than simply not inserting the delimiter.
@nik-rev Thanks! I'll implement that when I have time (probably tomorrow).
omgggg this would be so nice !! this has been a pain point for me for a while
I tried to make tests for this, but I was not able to.
It looks like this is special-casing repeated characters. More generally to cover https://github.com/helix-editor/helix/issues/4035 I would like to see auto-pairs act on &strs or rope slices instead of chars
that would solve so much! various keyworded languages would suddenly become much more ergonomic as a result