pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Code navigation can open the destination in the actual path instead of symlinked path if symlinked directory was added to workspace

Open munael opened this issue 3 years ago • 0 comments

Environment data

  • Language Server version: 2022.7.20
  • OS and version: Windows 10, 19043
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.5

Code Snippet

# In mycode/test.py
import somelib
# Make sure that `somelib`'s folder is added to the current VS Code workspace
somelib.somefunc()
# [Go to definition] on `somefunc`

Repro Steps

  1. See the code snippet above.
  2. Note that before navigating to definition for the function, you would be in mycode/test.py.
  3. Create a symlink to /full/path/.../somelib and add the symlink directory to the VSCode workspace.
  4. Navigate to somefunc from within test.py.
    1. You should be in somelib/__init__.py as seen in the breadcrump bar, as expected for directories added to the workspace.
  5. But instead, you may actually find yourself in, /full/path/.../somelib/__init__.py.
  6. This breaks many other features, like the python version used that's assigned to somelib's workspace entry. If you get served the version of the file with its full path, it's not considered part of the workspace.

Expected behavior

XXX

Actual behavior

XXX

Logs

Trying to extract this in a clean environment.

XXX

munael avatar Jul 07 '22 14:07 munael