helix icon indicating copy to clipboard operation
helix copied to clipboard

feat(auto-pair): auto-pair triple quotes properly

Open aster-void opened this issue 6 months ago • 4 comments

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

| -> '|'
'| -> ''|
(((| -> ((((|)

aster-void avatar Jun 06 '25 08:06 aster-void

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 avatar Jun 07 '25 15:06 nik-rev

@nik-rev Thanks! I'll implement that when I have time (probably tomorrow).

aster-void avatar Jun 09 '25 16:06 aster-void

omgggg this would be so nice !! this has been a pain point for me for a while

Axlefublr avatar Jun 11 '25 03:06 Axlefublr

I tried to make tests for this, but I was not able to.

aster-void avatar Jun 16 '25 04:06 aster-void

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

the-mikedavis avatar Jul 26 '25 21:07 the-mikedavis

that would solve so much! various keyworded languages would suddenly become much more ergonomic as a result

Axlefublr avatar Jul 26 '25 21:07 Axlefublr