user1774816
user1774816

Reputation: 11

VS Code: Is there a way to ignore local cache when using F12 'Go to Definition' and just look at files in the folder I have opened?

While using VS Code, I like to use the F12 'Go to Definition' feature often. The issue I have with this is that it always opens local cached versions of the scripts and never the ones I have opened in folder view. Is there a way to restrict this feature to only look at what files I have opened in the folder view?

Mocked up a quick example here: enter image description here

In the above image, I highlight the print_string function and press F12. This opens up the local cached version seen on the right side that is in my C:\Temp\ folder, rather than opening the file from within my_repo folder that I currently have opened on the far left.

Side note that this was all setup by hand just to show the example and if you tried this, it wouldn't actually do this. In the real issue with my other code, the cached code is from another program that downloads the whole repo locally.

I've tried looking at all of the different hotkey's available. I've looked into the different excludes (files: exclude and search: excludes) and nothing I tried worked, but I may have been putting in the patterns wrong. I was trying something like this: **/Temp. I've also looked into some config files that may work but was unable to find anything specifically for what I am looking for.

I've also tried using the following settings in the settings.json:

    "python.autoComplete.extraPaths": [
        "D:/my_repo/**"
    ],
    "python.analysis.extraPaths": [
        "D:/my_repo/**"
    ],
    "python.analysis.include": [
        "D:/my_repo/**"
    ],
    "python.analysis.exclude": [
        "C:/Temp/**"
    ]

Upvotes: 0

Views: 592

Answers (0)

Related Questions