-
Notifications
You must be signed in to change notification settings - Fork 133
Fix "go to definition" and resolving imports #466
Comments
Fix microsoft#466: Fix "go to definition" and resolving imports The fix is to put user search paths in front of workspace directory so that modules inside extra paths can be used as roots for packages
@busykoala A new build with #467 is in progress and should show up in daily in a bit. |
Thank you very much! The version I tried now, could resolve imports again with given settings. Not yet solved in my case is 'go to definition' which once was working properly (about three days ago).
Rather than this file structure
As I mentioned to avoid infinit loading on 'go to definition' it yet (and still) is necessary to search exclude |
Is there an error message before that disposed message? That should only occur after an exception occurs in a different part of the code (#448), but the initial error should be in the same output panel. |
Well I think it's not really an error message except of 'no definition found for...' in the vscode gui.
But it doesn't seem to scan the additional files initially. So the output makes sense. |
@busykoala , I've tried to recreate the file structure with symlink, but for me |
I've just tried different repositories with the same structure. In smaller project it worked having these two lines in my settings:
With bigger projects it's not working. Therefore I guess it is regarding the size of projects. I'm sorry I didn't figure that out before. Thank you for the help and let me try python language server when it advanced a little more. |
Fix microsoft#281: Support "go to definition" for namespace packages Fix microsoft#466: Fix "go to definition" and resolving imports The fix is to put user search paths in front of workspace directory so that modules inside extra paths can be used as roots for packages
* Clean up Completions, Find References and Hover unit tests. * Initial commit * CoreProduct buildable * Product buildable except IronPython * Move VS-specific file * add hack to prevent True/False/None/... from being use-before-def (#464) * Fix for extra paths inside workspace (#467) Fix #281: Support "go to definition" for namespace packages Fix #466: Fix "go to definition" and resolving imports The fix is to put user search paths in front of workspace directory so that modules inside extra paths can be used as roots for packages * Last port * - Add nuspec - Fix #501: PTVS-LS Integration: Fix LS hanging during file changes - Fix #502: PTVS-LS Integration: Add required *.py files to the vsix * Address CR comments
I thought I'd give vscode a shot again. My language server relevant settings are:
using microsoft language server in vscode 1.30.2 and the correct python environment. I tested with the repository https://github.com/4teamwork/opengever.core/ which has the setup described above and reliably doesn't work (going to definition, completion suggestions). After indexing (I guess indexing has finished because there are no new logs of indexing anymore) when trying to use
It stays like that for minutes (I only waited around 5') until one quits the program. I'm not totally sure that the settings are correct, but I couldn't figure out why it shouldn't work like that. |
To verify perf with #546. |
It looks like the omelette is being indexed and also does not show any error of not found imports but I'm still not able to make use of |
@busykoala - so what is the current problem? Is there particular code/workspace we can use for repro? LS analysis was rewritten so I'd like to verify whatever didn't work for you now does. |
I tested the issue again now. The repo I used is https://github.com/4teamwork/opengever.core/ Steps to get there:
Now the project should be setup. I open it in code with the python relevant settings and using the same environment as used to bootstrap:
The version of vscode is 1.31.1 and because of A use case which does not work: If I open the file
It does not go to the definition and the blue line on top starts going from left to right (indefinitely until closing the application). |
Just adding that I too am facing this same issue as @busykoala has detailed so well. The blue bar appears on top, keeps "loading" but never stops until you reload the window or quit the appllication. The "ctrl+click" method works fine until some unknown point in time when it stops turning certain symbols into links and then this happens |
This happens in both cases ie. whether jedi is enabled or disabled. When jedi is disabled: (MS python language server kicks in) |
We released a new version of the language server to the beta download channel (0.2.16). You can set this in your VS Code
I'd appreciate it if you could retest with your setup. |
@jakebailey I just updated to 0.2.16, "Go to definition" works. |
The update was a major improvement. For some imports I can go to definition now and it stopped the looping thing of the loading bar.
|
After upgrading to beta build.
PS : I set PYTHONPATH before opening vs code from command line. Sorry for bad formatting |
That is #719. It'd be better for you to file issues if they differ from the original issue in this thread. |
With these settings it is working perfectly fine for some time (around a minute) and then something breaks (I think this is the initial error):
settings workspace settings (in
user settings (
|
@busykoala - the exception should be fixed in 0.2.36 that is coming out ~ March 29th Since the item is evolved with many cases fixed, I am closing it. Please open new issues for the cases you still discover. Thanks. |
What is the message being squiggled? If the import isn't resolved, then it won't be able to find the definition. |
I believe it's a linter complaining about lack of module documentation. The import should be valid. |
A linter meaning an external linter, or a message generated by the language server? (It'll say Also, what's in your |
You're at the latest version, correct? I recently fixed some things related to setting a path to Since I think it's getting resolved, it's probably not related to the |
I'm running 2019.3.6558 (8 April 2019) of vs code python extension. Not sure if there are any steps I need to do to upgrade LS? I'll create a new issue. |
The LS version is different from the extension; you can find the language server version printed in the Python output panel (or in the directory name for the download inside the Python extension's folder). |
Fix microsoft#281: Support "go to definition" for namespace packages Fix microsoft#466: Fix "go to definition" and resolving imports The fix is to put user search paths in front of workspace directory so that modules inside extra paths can be used as roots for packages
I have
"python.analysis.downloadChannel": "daily"
activated.The update two days ago broke the 'go to definition' feature for my setup.
I'm using vscode and it's regarding a large plone project using the omelette as described below.
To avoid language server load infinitely (which would be another issue, maybe related to this), I excluded the
parts/omelette
withsearch.exclude
.Below that in the settings, I added the
parts/omelette
with:"python.autoComplete.extraPaths": ["${workspaceFolder}/parts/omelette", ],
which seemed to work for the last few days now.By 'it seemed to work' I mean it could resolve the omelette imports and jump to definitions.
Now it sais 'no definition found for...' and the imports can't be resolved anymore.
For what I can see in the output, before the update, it used to analyse from
autoComplete.extraPath
, which it does not anymore since it updated the language server today.(
parts/omelette
contains symlinks to cross-project sources in a local directory.)The text was updated successfully, but these errors were encountered: