suppose i want to report a variable state in NodeJS and/or JavaScript, for example:
console.log("myvar['"+property+"'] = "+myvar[property]);
because I'm a lazy guy, i want only to enter "myvar[property]", apart from console.log.
at start, i would enter :
console.log(myvar[property]);
then copy/paste "myvar[property]" :
console.log(myvar[property]myvar[property]);
adding " = +":
console.log(myvar[property] = myvar[property]);
then surrounding "myvar[property] = " by '"':
console.log("myvar[property] = "+myvar[property]);
i want to see the property value in the "left" hand side, then i sourround "property" by '"':
console.log("myvar["property"] = "+myvar[property]);
here is my suggestion, could it be possible by selecting "property" to add two "+" signs on each side of "property" in order to make it :
console.log("myvar["+property+"] = "+myvar[property]);
could that last step be implemanted in TextMate ?
On 5 Dec 2013, at 13:05, Yvon Thoraval wrote:
suppose i want to report a variable state in NodeJS and/or JavaScript, for example:
console.log("myvar['"+property+"'] = "+myvar[property]); […] could that last step be implemanted in TextMate ?
Given your steps I would suggest creating a new snippet that is:
"+${TM_SELECTED_TEXT}+"
Then set the scope selector to:
source.js string & dyn.selection
And set the key equivalent to ".
This way, when you have a selection in a (JavaScript) string and press " then it wraps it in the proper string append syntax. In all other contexts, the double-quote key works as default.
2013/12/5 Allan Odgaard mailinglist@textmate.org
This way, when you have a selection in a (JavaScript) string and press " then it wraps it in the proper string append syntax. In all other contexts, the double-quote key works as default.
Fine, thanks a lot !