Home > Enterprise >  Can I configure VSCode to handle symlinked source files as normal files?
Can I configure VSCode to handle symlinked source files as normal files?

Time:10-08

My filestructure looks like this:

    deploy/
        shared/
            share.py
        box1/
            foo.py
            symlink-to-share.py
        box2/
            etc...

VSCode (on macOS), when I click on symlink-to-share.py sees only the non-human-readable symlink raw content and not the file to which it is pointing.

This is really not useful behaviour. I can't think of any situation someone would want this. Sure, it could modify the icon to illustrate it is a symlink. But I want to click it and see the file contents, and edit the file!

Is there some VSCode setting for enabling this?

CodePudding user response:

TLDR: Create your symlinks with ln -s src dst and VSCode works with them fine.

Don't use {drag, OPT CMD drop}. This creates an 'alias', which is something different.

> pwd
/Users/pi/Desktop/symtest

> echo foo > foo.txt
> cat foo.txt
bar

> ln -s foo.txt works.txt
> # do {drag, OPT CMD drop} on foo.txt and rename to alias.txt 

> ll
total 16
-rw-r--r--@ 1 pi  staff   6.0K  5 Oct 11:28 .DS_Store
-rw-r--r--@ 1 pi  staff   872B  5 Oct 11:25 alias.txt
lrwxr-xr-x  1 pi  staff     7B  5 Oct 11:24 works.txt@ -> foo.txt
-rw-r--r--  1 pi  staff     4B  5 Oct 11:11 foo.txt

> cat foo.txt
bar

> cat works.txt
bar

> cat alias.txt
bookmark880A�O���AUserspiDesktopsymtestfoo.txt ,<Ӽ
�j
 �%?�x���AÆW�   file:///πT��A��D�$BFFB98D1-F7F8-43EB-AF2F-FA831016FD01���/3dnibtxt????����\��@�TUV � D T � ` p  �0 �(� �8���L"��```

enter image description here

  • Related