Closed jasonm23 closed 2 years ago
Fixed in these commits.
c2fcbc149204800fadb57592d4db96f12d55471c
854b1018df044a3df14fb2b83fb058e2c2dc1183
f8bdb785adf4ce364196ee98e93325df22bcf385
850e44f0e1b3a5678590216a98a6c8f3101b2772
5b86d94637249ebf820ec94b8bfb47d6561fa369
c5507344e1ba7ddbce6d755823c2f8503f9e28b4
66c01fd0874c47acccd98992a6cab3a4beca8fd1
Given an auto-snippet which is defined that uses a special yasnippet form (
${n:...}
) for example when a field has implicit casing rules.When it is expanded over a region and the special form is on
$1
Then it will expand incorrectly.
Triage / root cause summary
During
aya-expand
if a region is detected the following happens.str
$1
is replaced with$0
. This allows the snippet to expand and place the cursor at$0
when the expansion is complete.str
string is then inserted at point.In the cases where
$1
is a special form, the replacement doesn't happen as planned and this breaks the expansion.Potential solutions.
YASnippet provides a mechanim for working with a selected region,
yas-selected-text
and(yas-selected-text)
use
(yas-selected-text)
instead using our hand-rolled save / insert regioncheck for optional
{
when modifying the exit field to be$0
(so it'll be${0...
)[x] make this operation a testable function
[x] Add tests