Comments (2)
In the latest jedi code, see /jedi/evaluate/sys_path.py
at the function get_sys_path()
. We could either "pretend" to be a VIRTUAL_ENV (in order to be picked up here) or monkey-patch the get_sys_path()
function. Or submit a jedi patch.
from vim-conda.
Ok, so it turns out that I misread the jedi-vim code. In fact, jedi-vim does really modify the sys.path
of the embedded Python...which is what I am doing currently in vim-conda.
There are other issues. In /jedi/evaluate/sys_path.py
, the get_sys_path()
function looks like this:
def get_sys_path():
def check_virtual_env(sys_path):
""" Add virtualenv's site-packages to the `sys.path`."""
venv = os.getenv('VIRTUAL_ENV')
if not venv:
return
venv = os.path.abspath(venv)
p = os.path.join(
venv, 'lib', 'python%d.%d' % sys.version_info[:2], 'site-packages')
sys_path.insert(0, p)
check_virtual_env(sys.path)
return [p for p in sys.path if p != ""]
The problem I've observed is that this function gets called a bunch of times while editing code. After one lookup for a completion, the embedded Python's sys.path
looks like this:
Lots and lots of the same path getting .insert(0, p)
ed. vim-conda does not do this: I am carefully managing the modification of sys.path
at the moment. I would think that jedi-vim should operate lookups on a copy of sys.path
rather than modify the actual one in the embedded vim-python (I wrongly assumed this was how it worked) but I don't yet know enough about how Jedi works to make a definitive statement about this yet.
I was working on a patch for jedi to incorporate a check for the Conda-specific environment variables, completely analogous to the VIRTUALENV version, but I think I'll hold off for now. The patch looked something like this:
Now that I see that jedi-vim modifies sys.path
anyway, I'm going to go ahead and stick with my current design. Also, jedi-vim does not have to be modified in this case.
from vim-conda.
Related Issues (20)
- Python 3 support? HOT 18
- Improve documentation page for vim HOT 2
- Enable root conda environment HOT 4
- Suppress Message on Startup HOT 5
- Massive error log on startup HOT 21
- msg_suppress not defined HOT 5
- python 2 & 3 compatibility HOT 2
- E887: Sorry, this command is disabled, the Python's site module could not be loaded. HOT 1
- vim-conda is not compatible with the latest conda env activation mechanism HOT 5
- Issue with Jedi after install vim-condo HOT 3
- Had Error: "UnboundLocalError: local variable 'current_env' referenced before assignment" at line 336 in conda_change_env, fixed it myself, here is what I did. HOT 1
- Showing name Error. I have installed spacevim and anaconda as well, but I don't know why this error is showing. HOT 2
- Set environment in vimrc HOT 1
- How to set default conda env $CONDA_DEFAULT_ENV?
- Startup errors in Neovim on windows HOT 3
- Source conda.sh on startup? HOT 2
- how to set CONDA_EXE on MS Windows? HOT 2
- Activating the environment that was active during vim startup fails HOT 1
- [Window] Not found the CondaChangeEnv command in vim HOT 16
- The Issue about :CondaChangeEnv HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-conda.