1
0
forked from VimPlug/jedi
Commit Graph

87 Commits

Author SHA1 Message Date
Dave Halter
86071dda54 Use a different sys path for import completions and import type inference
Fix tests of the #1451 pull request
2019-12-01 00:12:19 +01:00
Sam Roeca
1ba83414a5 Change search strategy for adding parent paths:
1. skip dirs with __init__.py
2. Stop immediately when above self._path
2019-11-30 10:14:28 -05:00
Sam Roeca
c2fd7b3104 Fix: upward search omits unnecessary paths
In the previous implementation, Jedi's traverse_parents function
traversed parent directories to the system root every time. This would
inadvertently add every folder to the system root every time. Obviously,
this is not the behavior desired for the import system.

This commit collects directories in an upward search until we:

1. Hit any directory without an __init__.py, AND
2. Are above self._path.
2019-11-29 21:12:12 -05:00
Sam Roeca
4bc4f167e9 Revert "Fix: no longer shows folders recursively to root"
This reverts commit 03b4177d3d.
2019-11-29 20:11:23 -05:00
Sam Roeca
03b4177d3d Fix: no longer shows folders recursively to root
In the previous implementation, Jedi would's traverse_parents function
traversed parent directories to the system root every time. This would
inadvertently add every folder to the system root every time. Obviously,
this is not the behavior desired for the import system.

This pull request provides a new argument to the traverse_parents
function, "root", which represents the root parent for the search. This
argument defaults to None, thereby preserving the existing behavior of
the function.

I chose to duplicate some code for performance reasons. Since I'm trying
to avoid too much path manipulation magic, we do:

* a search to a valid specified root, OR
* a simple upward search until hitting the system root when there is no
valid root specified.
2019-11-28 23:04:08 -05:00
Dave Halter
03920502c4 infer_state -> inference_state 2019-08-16 11:44:30 +02:00
Dave Halter
a5dff65142 Evaluator -> InferState 2019-08-15 00:37:51 +02:00
Dave Halter
3b4f292464 Move the evaluate package to inference 2019-08-15 00:14:26 +02:00
Dave Halter
c413b486fb Actually import IsADirectoryError 2019-06-22 15:43:11 +02:00
Dave Halter
3ae4a154f9 Fix project search if a directory is called manage.py, fixes #1314 2019-06-22 14:04:32 +02:00
Dave Halter
8c9ac923c6 Fix import names from sys path generation 2019-04-08 19:35:58 +02:00
Dave Halter
5743f54d69 One more relative import fix 2019-03-08 16:01:56 +01:00
Marc Zimmermann
cc0c4cc308 fixing permission denied errors with project.json 2019-02-16 04:28:26 +01:00
Dave Halter
4b276bae87 The import resolution for namespace packages was wrong
With this change we can now include all parents of the script, which will make
relative imports always work.

Now the whole meta_path is scanned and not just importlib's PathFinder.

Fixes #1183.
2018-07-21 00:16:10 +02:00
Dave Halter
a12d62e9c9 Don't mutate the sys.path. This is pretty nasty bug that fixes #1148 2018-07-04 08:40:05 +02:00
Dave Halter
a972d49e88 Cache default environment 2018-04-15 15:28:05 +02:00
Dave Halter
9f07e7e352 Remove from_executable, were not really using it, yet. 2018-04-14 15:13:02 +02:00
Dave Halter
b8e879bc53 DefaultEnvironment -> SameEnvironment 2018-04-12 09:00:19 +02:00
Dave Halter
074d0d6d07 Include __init__.py files in search for the project directory, fixes #773 2018-03-04 21:36:59 +01:00
Dave Halter
24adebb69d Add the travere_parents function to a utility directory 2018-02-16 21:07:36 +01:00
Dave Halter
5453566352 Use the project path as a prefix, because many times it's used as a higher priority than other stuff 2018-02-16 20:37:03 +01:00
Dave Halter
424b6ae907 Rename of buildout stuff 2018-02-16 14:56:49 +01:00
Dave Halter
039e7ba07b Some more sys path corrections.
The sys path should be defined more or less in the beginning and not be different for all modules
2018-02-16 14:39:01 +01:00
Dave Halter
6a11b7d89e Generalize the use of smart import paths
Now a lot more parts of the current scripts path are used as a sys path.
2018-02-16 12:40:31 +01:00
Dave Halter
863fbb3702 Better handling of smart sys path 2018-02-16 11:57:58 +01:00
Dave Halter
91d3c1f6d3 Force unicode on django paths 2018-01-30 00:40:50 +01:00
Dave Halter
1304b4f9e8 Reorder some open flags for Python 2 2018-01-26 01:31:47 +01:00
Dave Halter
68f840de60 Refactor django path support 2018-01-24 19:13:05 +01:00
Dave Halter
e4559bef51 Fix project path finding 2018-01-23 20:30:27 +01:00
Dave Halter
e6f934de11 Add a repr for Project
Also remove setstate from it, since we intend to serialize it with json.
2018-01-23 19:21:50 +01:00
Dave Halter
d61aa50399 Remove the get_default_project caching 2018-01-17 19:23:30 +01:00
Dave Halter
9b5e3447d9 Make the new project API fully work in tests 2018-01-17 09:54:11 +01:00
Dave Halter
fe813292cf Try to migrate to the new project API 2018-01-16 23:56:35 +01:00
Dave Halter
9b9587a9dd Refactor to make configuratios of sys paths easier 2018-01-16 19:20:55 +01:00
Dave Halter
ddaf175b11 Use the evaluate.project sys path stuff for api.project 2018-01-16 10:03:28 +01:00
Dave Halter
c6240d5453 Cache the default project 2018-01-16 00:20:33 +01:00
Dave Halter
2a0e8f91d3 A possible introduction for projects 2018-01-15 23:57:08 +01:00