2017.2 Escape Slashes Now Added to Inserted Live Templates - Can I disable this?
I actually have a Live Template that is '..' (including the quotes). I use it frequently to insert a break in a literal string so that I can output something else, i.e. 'This is a string that needs a global variable '.HERE.'.'
Suddenly, with the 2017.2 update, this Live Template is being inserted with backslashes, i.e., ''This is a string that needs a global variable \'.HERE.\'.'. This is obviously the opposite of what I want the Live Template to do, which is to insert a break in the string.
Is there a way to disable this? It is very annoying, and I'm back to typing this string breaks by hand (or forgetting that it doesn't work correctly now and redoing it by hand).
Note: This seems to be the "new" Paste behavior applied to Live Template insertion, but I just want my Live Templates to insert like Paste Simple - after all, that's the way I created them.
Thanks, Fritz
Please sign in to leave a comment.
Hello,
How exactly do you insert the template? Does it happen in PHP files or some other? What is the context (string, var, parameter, attribute)? Some particular code example is necessary.
Also do you have any 3rd-party plugins that could cause such behavior? Would be great if you could try with all custom plugins disabled.
Hi Vladimir,
This is a Live Template that I use in PHP files.
The Template text is:
'.$END$.'
Here is a screenshot of the template setup:
I always insert the template by typing the abbreviation and hitting the Tab key.
In response to your question, I tried using the Insert Live Template menu item (command-J) then selecting the Live Template to insert, and found that method to work as expected – backslashes are not added, so the issue only occurs when I type the abbreviation in the code and hit Tab to expand i.
As indicated in my original post, this template is intended to insert a break into the middle of a string, i.e., "terminate string (single quote mark), concatenate (period), concatenate (period), reopen string (single quote mark), then leave the cursor between the concatenation periods so that I can insert some other PHP code, like a global variable or function usage, for example. I only use it in strings.
Following is a code example:
I do not have any custom 3rd-party plugins installed.
This new behavior started immediately when I updated from PhpStorm 2017.1 to 2017.2. I've been using this Live Template without encountering this issue since version 7 of PhpStorm.
Thanks, Fritz