Skip to content

ty resolves symlinks when going to source #2523

Open

Description

@Boon-in-Oz

Summary

The standard setup at my workplace is to junction our development directory. So I work in C:\whatever but the physical location of all my files is actually S:\whatever. In VS Code, when I hit F12 on a symbol, ty opens the source code in the S:\whatever location.

I briefly mentioned it in issue 1967, but it turned out not to be the source of that bug.

The python-environment-tools project just fixed this bug in their locator: microsoft/python-environment-tools#277

Any chance you could implement a similar fix in ty please?

Version

0.0.12

Activity

  1. MichaReiser commented on Jan 16, 2026

    @MichaReiser
  2. MichaReiser commented on Jan 16, 2026

    @MichaReiser
    Member

    Does this apply to project files or only to third-party files (pandas, etc)? We're very careful not to canonicalize paths and do so only in very few instances. But I'd have to take a closer look at what's happening.

    What steps should I use to reproduce this? E.g. is it something like:

    lib.py:

    class A: ...
    

    main.py:

    from lib import A
    
    a = A()
        ^ click here
  3. Boon-in-Oz commented on Jan 27, 2026

    @Boon-in-Oz
    Author

    Ah, so it doesn't happen in a nice clean example like that. The key here seems to be that we also use a .pth file.

    In my workspace, my Python interpreter

    		"python.defaultInterpreterPath": "${workspaceFolder}/../python3.10.11/python.exe",
    

    has an associated .pth file in its Lib/site-packages dir, listing packages by relative path, eg

    ../../../packages/package_one/1.0/python
    ../../../packages/package_two/1.0/python
    

    (They are in version subdirectories because we use Rez most of the time now. The .pth file is hopefully on its way out but we're not there yet.)

    If lib.py and main.py are in the package_one/1.0/python/package_one directory, and main.py says

    from package_one.lib import A
    

    then clicking on A or lib and hitting F12 would take me out of my project files to lib.py in the physical location.

  4. added
    navigationGo-to definition, declaration, implementation, and type; find references, symbols, and hierarchies
    on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    navigationGo-to definition, declaration, implementation, and type; find references, symbols, and hierarchiesserverRelated to the LSP server

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions