abo-abo / auto-yasnippet

quickly create disposable yasnippets
246 stars 15 forks source link

Multiple placeholders failed #21

Closed smallst closed 8 years ago

smallst commented 8 years ago

i try to select a region and exec aya-create as Multiple placeholders shows in Usage, but only cursor line changed, was i misunderstanding how to use Multiple placeholders?

abo-abo commented 8 years ago

Works fine for me. Can you eval aya-current after you call aya-create?

smallst commented 8 years ago

i get the Undeclared variable or function 'count_ofred' error and i have no aya-current function

abo-abo commented 8 years ago

I meant M-x eval-expression, enter aya-current and RET.

smallst commented 8 years ago

as for

~FooType get~Foo() {
    // Get the ~foo attribute on this.
    return this.~foo;
}

when i begin select from first line, aya-current is "}" when i begin select from last line , aya-current is "$1 get$2() {"

abo-abo commented 8 years ago

Try to reproduce with emacs -Q -l yasnippet.el -l auto-yasnippet.el.

smallst commented 8 years ago

same result. just in case, i think select a region means C-space for mark set then move cursor ,then i exec aya-create.

abo-abo commented 8 years ago

emacs-24.5 -Q -l yasnippet.el -l auto-yasnippet.el README.md

This works perfectly fine for me:

smallst commented 8 years ago

oh, i use melpa-stable and auto-yasnippet is 0.3.0. let me try 20160809.46

smallst commented 8 years ago

yeah, ver.20160809.46 is ok. aya-current is

"
$1 get$2() {
    // Get the $3 attribute on this.
    return this.$3;
}"

by the way, although there is a white space after $1. but when i use aya-expand, there is no space before 'get$2' , why ? screenshot_2016-08-12_22-44-54

abo-abo commented 8 years ago

No idea, I have the whitespace.

smallst commented 8 years ago

ok. Thank you very much!

smallst commented 8 years ago

oh, i try several times and find when select region contains a blank line before first line, the whitespace will miss, if the select region is exactly, everything is fantastic!