Closed gmosteoru closed 11 years ago
Sorry but, what you mean, cpython clone? What steps to reproduce the problem?
through cpython clone I mean:
hg clone http://hg.python.org/cpython
STR:
Expected: I'm presented with a list of islink function definition from files that are inside the project
Actual: I'm presented with options from the system python installation, namely: /usr/lib/python2.7/ntpath.py /usr/lib/python2.7/posixpath.py
Note: If I use ST3 build in goto definition I'm presented only with options from within the project, which I consider it's better, since I'm working on the actual thing:
Lib/macpath.py Lib/ntpath.py Lib/posixpath.py posixpath.py
Made some experiments:
Works with next projects settings for me :
{
"folders":
[
{
"path": "/storage/PythonProjects/cpython"
}
],
"settings": {
"python_package_paths": [
"/storage/PythonProjects/cpython/Lib"
]
}
}
"python_package_paths"
will be added in the head of the PYTHONPATH, what will helps Jedi to find required modules
UPD: But still little bit odd, case islink
in macpath.py
was not found.
UPD2: Found same troubles with vim-jedi
- jedi looks for islink
definition in the system (environment) python
I've modified my .sublime-project to look like this:
{
"folders":
[
{
"path": "apps_projects/cpython"
}
],
"settings": {
"python_package_paths": [
"apps_projects/cpython/Lib"
]
}
}
But nothing changes for me.
Is there anything else I should also do ?
Paths should be global
Thanks, that was it.
Great :)
window.project_file_name()
(ST3) could be used to support relative paths like these in the project settings, but it's difficult to determine if the setting comes from the project file.
Here is what I have in mind (untested):
the_setting = "python_package_paths"
# Load some settings objs
prefs, vprefs = sublime.load_settings("Preferences.sublime-settings"), view.settings()
# Read the view's setting
view_paths = vprefs.get(the_setting)
vprefs.erase(the_setting)
view_paths_after = vprefs.get(the_setting)
# Analyze what we have
if view_paths_after != view_paths:
# The setting is view-specific
# Reset the erased setting
vprefs.set(the_setting, view_paths)
# ...
elif view_paths_after != prefs.get(the_setting):
# The setting is project-specific
pass
else:
# The setting is global
pass
While testing jedi on a cpython clone I noticed that I only get results from my system python installation, and not from the clone I was working on.
The file tried was cpython/Lib/distutils/dir_util.py
For the first call to is_linlk function from this module I don't even get the system suggestions.
On the other hand F12 gives me good suggestions.
Also, find usages seems to have problems with public functions, because I only get usages for private ones.