0

Trying the following yas snippet

# -*- mode: snippet -*-
#name : vuex-action
#key : va
# --
[${1:$$(capitalize-word yas-text)}]: ({ commit, dispatch, getters, }, { $2, }) => {
  commit($1, { $2, });
},

and get the following errors in messages buffer

Wrong type argument: stringp, (integerp #("H" 0 1 (fontified nil face (rainbow-delimiters-depth-1-face))))
Wrong type argument: stringp, (integerp #("HE" 0 2 (fontified nil)))
Wrong type argument: stringp, (integerp #("HEE" 0 3 (fontified nil)))
Wrong type argument: stringp, (integerp #("HE" 0 2 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HEL" 0 3 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELL" 0 4 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO" 0 5 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_" 0 6 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_W" 0 7 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WR" 0 8 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_W" 0 7 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WO" 0 8 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WOR" 0 9 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WORL" 0 10 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WORLD" 0 11 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Quit [4 times]

1. How to fix?

2. Also how to replace space with the underscore in the word as you type?

  • if you want to use functions inside sniper tml set single quat mark infront: '(func-name) – Hellseher Mar 21 '18 at 21:18
  • I have tried, doesn't work [${1:'(capitalize-word yas-text)}] it just display the function as the name inside expanded snippet – DmitrySemenov Mar 21 '18 at 21:38
  • 1
    Embedded Emacs-lisp code Emacs-Lisp code can be embedded inside the template, written inside back-quotes (`). The lisp forms are evaluated when the snippet is being expanded. The evaluation is done in the same buffer as the snippet being expanded. joaotavora.github.io/yasnippet/snippet-development.html – Hellseher Mar 21 '18 at 21:55
0

solution

# -*- mode: snippet -*-
#name : vuex-action
#key : va
#contributor : Dmitry Semenov
# --
/**
 * $1
 */
[${1:$(upcase (replace-regexp-in-string " " "_" yas-text))}]: ({ commit, dispatch, getters, }, { $2, }) => {
  commit(${1:$(upcase (replace-regexp-in-string " " "_" yas-text))}, { $2, });
},

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.