Reputation: 6181
PhpStorm has this amazing feature where when you press Ctrl + Space + Space
between the <script src=" "
tag it shows a dropdown of all the scripts and you can quickly insert the script's path.
My trouble is that it always adds a bunch of '../../../public/static' in front of the script (even though I've marked the public
directory as my resources root).
Any way so that it starts from /static/
instead of ../../../public/static
(get rid of the leading dots and slashes)
Upvotes: 0
Views: 157
Reputation: 165511
Straight away -- not sure at all.
But here is some workaround: complete first folder in the path first (the /static/
part) and then invoke that "list-all-scripts" completion.
This way the remaining path will be inserted using already completed /static/
part.
I've just tested this in PhpStorm 2016.1.2 (inside .twig file though, but it should not matter).
Instead of <script src="../../web/assets/vendor/fancybox/jquery.fancybox.js"></script>
I'm getting <script src="/assets/vendor/fancybox/jquery.fancybox.js"></script>
which is what you need.
EDIT: I've checked your comment and it is indeed enough to just use leading /
(instead of completing whole first folder) to have the rest path completed this way.
BTW -- it's not actually Ctrl + Space + Space
-- it's Ctrl + Space 2 times.
Upvotes: 1