mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Add Project.path, fixes #1622
This commit is contained in:
@@ -7,6 +7,7 @@ Unreleased
|
||||
++++++++++
|
||||
|
||||
- Added an option to pass environment variables to ``Environment``
|
||||
- ``Project(...).path`` exists now
|
||||
|
||||
0.17.1 (2020-06-20)
|
||||
+++++++++++++++++++
|
||||
|
||||
@@ -36,7 +36,7 @@ def complete_file_name(inference_state, module_context, start_leaf, quote, strin
|
||||
is_in_os_path_join = False
|
||||
else:
|
||||
string = to_be_added + string
|
||||
base_path = os.path.join(inference_state.project._path, string)
|
||||
base_path = os.path.join(inference_state.project.path, string)
|
||||
try:
|
||||
listed = sorted(scandir(base_path), key=lambda e: e.name)
|
||||
# OSError: [Errno 36] File name too long: '...'
|
||||
|
||||
@@ -150,6 +150,13 @@ class Project(object):
|
||||
|
||||
py2_comp(path, **kwargs)
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
"""
|
||||
The base path for this project.
|
||||
"""
|
||||
return self._path
|
||||
|
||||
@inference_state_as_method_param_cache()
|
||||
def _get_base_sys_path(self, inference_state):
|
||||
# The sys path has not been set explicitly.
|
||||
|
||||
@@ -39,7 +39,7 @@ class ChangedFile(object):
|
||||
if new_lines[-1] != '':
|
||||
new_lines[-1] += '\n'
|
||||
|
||||
project_path = self._inference_state.project._path
|
||||
project_path = self._inference_state.project.path
|
||||
if self._from_path is None:
|
||||
from_p = ''
|
||||
else:
|
||||
@@ -112,7 +112,7 @@ class Refactoring(object):
|
||||
|
||||
def get_diff(self):
|
||||
text = ''
|
||||
project_path = self._inference_state.project._path
|
||||
project_path = self._inference_state.project.path
|
||||
for from_, to in self.get_renames():
|
||||
text += 'rename from %s\nrename to %s\n' \
|
||||
% (relpath(from_, project_path), relpath(to, project_path))
|
||||
|
||||
@@ -192,7 +192,7 @@ class Importer(object):
|
||||
import_path = base + tuple(import_path)
|
||||
else:
|
||||
path = module_context.py__file__()
|
||||
project_path = self._inference_state.project._path
|
||||
project_path = self._inference_state.project.path
|
||||
import_path = list(import_path)
|
||||
if path is None:
|
||||
# If no path is defined, our best guess is that the current
|
||||
|
||||
Reference in New Issue
Block a user