Autocomplete path relative to resource root

I have the following file structure:

root/
somefile
dist/
src
/
img/
image.jpg includes
/ header.html index.html

src folder is set as a resource root. When I try to autocomplete <img> tag "src" attribute inside header.html using ctrl+spacebar — it inserts path relative to header.html (../img/image.jpg). Is it possible to somehow make webstorm to autocomplete path relative to src folder (resource root) instead (like so: img/image.jpg)?

6 comments
Comment actions Permalink

just type "img" and hit ctrl+space - path will be completed relative to resource root

 

1
Comment actions Permalink

Thanks! Is there a chance to get in the future a setting which will allow autocompletion relative to the closest resource root when pressing 2 times "Ctrl + space" within an empty attribute?

0
Comment actions Permalink

please feel free to file feature request to youtrack, https://youtrack.jetbrains.com/issues/WEB

0
Comment actions Permalink

Hello, 

I find the subject to be more relative to my question.

Is there a way to just type the "/" character in the path and without hitting "Ctrl + space", the sub menu for file path auto pops up? Is there a configuration for this?

0
Comment actions Permalink

the subject doesn't seem to have a y relation to your question...

Anyway, no - there is no way to get the path completion auto-popup on entering slash.

It will work for imports/require() calls in 2019.3 (see https://youtrack.jetbrains.com/issue/WEB-32058)

1
Comment actions Permalink

Thank you Elena. It would be useful, but we already have a great suite! 

0

Please sign in to leave a comment.