Force autocomplete suggestions for file paths

会有一股神秘感。 提交于 2019-12-02 03:54:49

问题


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

  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.



来源:https://stackoverflow.com/questions/39130974/force-autocomplete-suggestions-for-file-paths

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!