Search code examples
phpstormphalcon

Force autocomplete suggestions for file paths


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) autocomplete suggestions not working
This is what I would like to happen. autocomplete suggestions working

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


Solution

  • 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):

    1. Have some code, e.g. $someVar = ['css' => 'aaa'];
    2. 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)
    3. Invoke shortcut to bring "Quick Fix" menu (Alt + Enter on Windows)
    4. Choose Inject language or reference from appeared menu
    5. Choose File Reference from next menu
    6. 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.