How do I get path auto-completion to enter paths relative to my public/ folder?

Happy new Year :)

Does anyone know how I can get webstorm to write absolute paths when it fills in paths to files?

As I have all my source files outside of the public root, when SCSS files are compiled to CSS, I need them to reference everything from /public not /source.



I've tried setting public as a "resource root" but this doesn't seem to affect this.

Any help, or advice on how to change my setup so that I'm compatible with WebStorm would be appreciated.

Cheers,
Dave



Attachment(s):
css-paths.png
6 comments
Comment actions Permalink

Not sure I follow you... marking 'public' as resource root does work for me - it is treated as a
project root when resolving paths, so 'assets' folder is suggested by completion after leading slash - see attached screenshot



Attachment(s):
resource.png
1
Comment actions Permalink

Hmm... that looks like exactly the functionality I want!

Not sure why it isn't working on my home install; I'll check later when back from work.

0
Comment actions Permalink

Hi Elena,

Ahhh... I just added a leading slash and it worked as expected! That was the piece of the puzzle I was missing.

It might be worth adidng this to the online docs, with example of relative and absolute paths, as well as some info about the Resources Root (I just guessed how to use this - I had no idea if it was the right thing to do or not, at the time).



One thing I don't understand (or know if it's possible) with the file picker, is: can we tab through paths, in the same way you can in the terminal?



That would be really useful.

I wrote a plugin for Komodo called AutoCode that allowed me to ALT+Click on files in the Project view, and it would automatically resolve the right path, and if a template was set up, would also inject the correct code per language - a bit like Live Templates.

If I knew Java, I would have a crack at that myself!

http://xjsfl.com/support/setup/komodo/autocode#places-integration



Attachment(s):
tabbed-file-autocomplete.png
1
Comment actions Permalink
can we tab through paths, in the same way you can in the terminal?

No, it's not posible:(

I wrote a plugin for Komodo called AutoCode that allowed me to ALT+Click on files in the Project view, and it would automatically resolve the right path

You can use 'Copy reference'  in file right-click menu to copy file path relative to project root to clipboard. But this action doesn't unfortunately take resource roots into account

0
Comment actions Permalink

If you know the file name .. then you could try suing Ctrl+Space twice (as suggested on your screenshots) -- it will list ALL files of applicable types (images in your case) from ALL locations.

If number of images is not huge and file name is more-or-less unique (not many similarly named files) then it may do the job.

0
Comment actions Permalink

Thanks for the reply both of you.

I feel that the path autocomplete functionality in webstorm is at a level where it gets the job done, but at a bare-minimum level. It doesn't feel like it's had the kind of thought put into it that a lot of the other editing tools have.

It's s shame, as working with files is something one does a lot, especially on smaller, bespoke sites without a CMS.

I'll probably add a feature request ticket :)

0

Please sign in to leave a comment.