Provide PHP string escapes
GoogleCodeExporter opened this issue · 15 comments
This should escape \, ', " and $
Original issue reported on code.google.com by axl.cod...@gmail.com
on 24 Jul 2013 at 9:23
Type: Feature
Original comment by axl.cod...@gmail.com
on 24 Jul 2013 at 9:23
I will see what I can do, however contributions are welcomed.
Original comment by vojta.kr...@gmail.com
on 29 Jul 2013 at 12:13
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
Hahaha. Incredible coincidence, I downloaded my first Java manual today. I'd
love to contribute when I finish learning Java. Your plugin is fucking useful.
Best regards.
Original comment by axl.cod...@gmail.com
on 29 Jul 2013 at 6:35
Good luck :)
How should it actually be excaped?
\ to \\
' to \'
and so on?
Original comment by vojta.kr...@gmail.com
on 30 Jul 2013 at 12:15
PHP has four kinds of strings, but I think that the most handy implementation
is create a single escape that makes the string ready for every kind of string.
So the escapes should be:
\ => \\
' => \'
" => \"
$ => \$
And no more ones.
Original comment by axl.cod...@gmail.com
on 30 Jul 2013 at 7:30
try this:
download http://plugins.jetbrains.com/plugin/7282?pr=idea
use following script:
import com.intellij.openapi.actionSystem.AnActionEvent
import static liveplugin.PluginUtil.*
registerAction("PHPStringEscapes", "ctrl alt shift U") { AnActionEvent event ->
transformSelectedText(event.project) {String s -> s.replace("\\", "\\\\").replace("'", "\\'").replace("\"", "\\\"").replace("\$", "\\\$")
}
}
show("Loaded 'PHPStringEscapes'<br/>Select text in editor and press
ctrl+shift+alt+U to run it"
Original comment by vojta.kr...@gmail.com
on 7 Aug 2013 at 9:37
* Installed Plugin.
* Downloaded Groovy libraries.
* Create plugin.
* Click Run.
IDE shows "Loading plugin" for a second in the status bar. Nothing else
happens. In fact, if I run the sample helloWorld pugin, it behaves the same
way, no helloWorld is shown xD
What can I be doing wrong?
Original comment by axl.cod...@gmail.com
on 9 Aug 2013 at 10:49
By the way, nothing happens on AltCtrlShiftU.
Original comment by axl.cod...@gmail.com
on 9 Aug 2013 at 10:49
I just tried it and hello world works fine for me.
But my script did not... because I did not pasted ) on the end of
show("Loaded 'PHPStringEscapes'<br/>Select text in editor and press
ctrl+shift+alt+U to run it"
:0
Original comment by vojta.kr...@gmail.com
on 9 Aug 2013 at 10:59
Now works wonderful!
Original comment by axl.cod...@gmail.com
on 9 Aug 2013 at 11:07
Good, I think it is better to just use LivePlugin for special things like
these, instead of adding them into this plugin.
Original comment by vojta.kr...@gmail.com
on 9 Aug 2013 at 11:11
Oh, seems a sad decission for me... Having the live plugin installed (new tool
visible is annoying) to be able to do a string-manipulation specific task,
while having your plugin installed. I'm sure lots of users will be happy with
that new feature, all PhpStorm users use PHP, and lots of IntelliJ IDEA users
also develop PHP with the PHP plugin...
Original comment by axl.cod...@gmail.com
on 13 Aug 2013 at 1:45
Ok then, you persuaded me :-) There is a lot of language specific actions
already anyway...
Original comment by vojta.kr...@gmail.com
on 13 Aug 2013 at 3:03
Great, I was afraid of feeling rude keeping on asking for the feature. I realy
congratulate you for your decission and thank you a lot for your great support.
Original comment by axl.cod...@gmail.com
on 13 Aug 2013 at 4:16
Original comment by vojta.kr...@gmail.com
on 21 Aug 2013 at 9:41
- Changed state: Fixed