Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Fix for extra paths inside workspace #467

Merged
merged 2 commits into from
Dec 7, 2018

Conversation

AlexanderSher
Copy link
Contributor

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

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
@jakebailey
Copy link
Member

If I have a folder structure like:

root
│   main.py
│
├───foo
│       __init__.py
│
└───some
    └───other
        └───foo
                __init__.py

Will adding some/other to the user search path then prevent the import of the first foo?

@AlexanderSher
Copy link
Contributor Author

Yes, PathResolver will pick the first module, which in this case would be some/other/foo.

@AlexanderSher
Copy link
Contributor Author

AlexanderSher commented Dec 7, 2018

What we can do is add foo to root as some.other.foo and to root/some/other as foo, but preserve old resolution order. This will still fix the bugs, but have more "natural" style of resolution.

@AlexanderSher
Copy link
Contributor Author

Unfortunately, this idea won't work because of the #468. If file is added to several roots, there will be more than one module name associated with it, which isn't supported by analyzer.

@AlexanderSher AlexanderSher merged commit 5764f7e into microsoft:master Dec 7, 2018
AlexanderSher added a commit to AlexanderSher/python-language-server that referenced this pull request Dec 22, 2018
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
AlexanderSher added a commit that referenced this pull request Jan 9, 2019
* 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
jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix "go to definition" and resolving imports Support "go to definition" for namespace packages
3 participants