How to make Ctrl-click work in Visual Studio Code when paths in source code don't match paths in filesystem?
Asked Answered
B

0

7

My access to the filesystem for our web server starts one folder deeper than the web server's root. So relative paths in our HTML look like this, for example:

<link href="/division/css/style.css" rel="stylesheet" />

But the path to that same file in my filesystem is:

s:\css\style.css

So whenever I CTRL-click on something in the editor I get an error because VScode is trying to open:

s:\division\css\style.css

But that doesn't exist. EDIT 1: my path does not include \division

I feel like I'm missing something obvious, but I've googled for hours and haven't found a solution to resolve this, such as a filter that strips "\division" from the filesystem paths or a mapping setting that tells VScode that relative path "/division" exists at S:.

EDIT 2: The division folder exists in the root of the share, and you can't map a drive to the root of a share ( \\server\, while allowed in explorer, isn't allowed in drive mappings). Neither would VScode allow me to open \\server\ as a folder. I tried creating a folder placeholder folder on my local drive containing another folder called division with a symlink inside that to \\server\division, while this looked like it worked in VScode, CTRL-Clicking on a link wouldn't work, it says the file doesn't exist. It looked like it wouldn't follow symlinks.

Bespeak answered 12/10, 2018 at 0:15 Comment(4)
Have you added the source folder to your workspace? I'd expect this to workDisqualify
@ChatterOne, I think I'm lacking the knowledge to fully understand your question. Using the example in my question, what would be the "source folder" and how would I add it to my workspace?Bespeak
I'm talking about the menu in "File -> Add folder to workspace..." . I mean: are you just opening the file? If you use Ctrl-P (or Command-P on Mac), are you able to search through the files?Disqualify
I had originally done it a bit differently, but I did it that way as well. The other part of my question is what did you mean as the "source" folder. I added "S:" which maps to "\\server\division". But as the links in the HTML link to "/division/css/style.css" when I try to ctrl-click them it tries to open "S:\division\css\style.css" which is not a valid path (my real path to that file does not include "\division". As the division folder is in the root of the server's share ("\\server\") I can't map to it (you can't map without a folder. And vscode will not accept \\server\ as a folder to openBespeak

© 2022 - 2024 — McMap. All rights reserved.