"Go To Definition" not working as expected.
See original GitHub issueComing from PyCharm, Go to Defintion is not working as expected. Usually going to package root works - but not functions or constants etc. When it does work it just takes me to __init__.py
of the package root.
MacOS 10.14.4 Visual Studio Code 1.34.0 PTVS: 2019.5.18875
FWIW I’m using pipenv
.
What am I doing wrong? This is detrimental to productivity.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Go to definition not working as expected when typescript ...
When working in a Typescript or a Javascript project importing this package, if I ⌘+click , I am taken to the type declaration....
Read more >VS 2019 ignores Go to Definition setting
In Visual Studio 2019, go to View --> Options --> Text Editor --> General · Either uncheck “Enable mouse click to perform Go...
Read more >Fix: VS Code Go to Definition Not Working - YouTube
Visual Studio Code (VS Code) is a very popular code editor among the developers of the world. This is due to it's awesome...
Read more >VS Code "go to definition" not working for js files
I am using a repository which has mixed js, jsx, ts, and tsx files. However, the "go to definition" feature is not working...
Read more >Step 'Go To Definition' not working - shows 'Project ...
When cursor is over a feature file step, pressing 'Go To Definition' results in a message box reading "Project Unavailable". I expected to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the info, @BeyondEvil. It was super helpful. 😃 At first I had some trouble reproducing the problem you described. After some tweaks I was only able to reproduce some of the issues. Please let us know if you can’t get the results I got, or if I missed anything (i.e. not covered by the 2 issues I opened).
To start off, I did the following:
python3.7 -m pipenv --python 3.7
python3.7 -m pipenv install
e2e/utils/database.py
(the extension automatically selected the pipenv virtualenv)At that point I was only able to check one of the items (for
e2e/utils/database.py
) and I didn’t have any problems there.For the rest I ran into the fact that the “e2e” directory is not on
sys.path
, so every import of the “api” module was an “unresolved import”. (The extension only adds the project’s root directory toPYTHONPATH
.) To work around this I added a top-level.env
file withPYTHONPATH=e2e
in it.Below are my final results, post-tweak. For some of the items it worked fine for me. I have opened 2 issues (#6312 and #6314) for the remainder.
Note that all this was using the language server (rather than Jedi). If you are using Jedi (the default), then trying add
"python.jediEnabled": false
to your settings.json file.e2e/utils/database.py
** “dadd” (of
self.db.dadd(...
on line 10) worked with just the initial stepse2e/tests/conftest.py
from api.base
takes me to the definition forapi.base
; I’ve opened a feature request for what you expectede2e/tests/api_tests/test-api.py
e2e/tests/api/*.py
(assuming you meant
e2e/api/orgs.py
)e2e/tests/conftest.py
@int19h I see! Well, you learn something new every day. 😊
I would really appreciate if you could move the issue to its rightful place.
Thank you!