I have the following snippet:
<snippet>
<content><![CDATA[console.log( ${TM_CURRENT_LINE/;$/$1/m}$0);]]></content>
<tabTrigger>conl</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log()</description>
</snippet>
Which will wrap a line/selection with console.log(); replacing any ‘;’ characters in the line. This is what I want if I select the line, but If I run the snippet (via a key binding) on a line without selecting text, it will duplicate the text.
Ex:
// If I trigger the keybinding while the cursor is at the beginning of the following line, with no text selected:
exampleFunction()
// becomes...
console.log( exampleFunction()); exampleFunction();
I’d prefer it replace the whole line. Is this possible?