问题
I am currently working on a controller file for a Phalcon project. I like how PhpStorm gives you autocomplete suggestions when writing a src or href value in an HTML file. I was wondering, is possible to enable autocomplete suggestions when adding resources in a controller?
This is what happens when I force autocomplete suggestions(Ctrl + Space)
This is what I would like to happen.
EDIT: I should also note that I have marked the folder, containing all my resources(ie. CSS, javascript, and images), as the "Resource root".
RE: EDIT
This does not affect availability of this feature/functionality in any way as "Resource roots" are used for path resolutions/validation and not for actual "offer this functionality or hide it" choice.
-LazyOne
回答1:
Unfortunately there is no real way of automatically providing such functionality in random string as it's hard to guess that file path is expected in this particular place (function parameters is different case -- here some hinting mechanics (special annotation) may work).
But .. you can forcibly enable it manually for each particular place (should last until file or project is closed):
- Have some code, e.g.
$someVar = ['css' => 'aaa'];
- Place caret inside
aaa
string (it has to be 3 or more characters, based on my observations, otherwise option in #4 will not be present -- must be some sort of optimisation/limitation from IDE side) - Invoke shortcut to bring "Quick Fix" menu (Alt + Enter on Windows)
- Choose
Inject language or reference
from appeared menu - Choose
File Reference
from next menu - Start using it (Ctrl + Space)
EDIT: I should also note that I have marked the folder, containing all my resources(ie. CSS, javascript, and images), as the "Resource root".
This does not affect availability of this feature/functionality in any way as "Resource roots" are used for path resolutions/validation and not for actual "offer this functionality or hide it" choice.
来源:https://stackoverflow.com/questions/39130974/force-autocomplete-suggestions-for-file-paths