Closed kovidgoyal closed 8 years ago
The simplest would be just a config variable that is loaded on server startup. In which case I can set that config variable and restart ycmd when editing a project that needs a custom path.
That sounds reasonable. YCM already has problems with detecting the path to the Python interpreter on some Windows machines so that option would be a good last-resort for such a use case as well.
Note to self: we'll need to reload user options from Vim to support changing the path to python while Vim is running.
It occurs to me that probably, there is no need for a separate config variable, the vim client could just send sys.path to ycmd when ycmd starts. This would mean that things will "just work" provided sys.path is setup before the first completion is triggered.
However, if there are some problems with this, I have no objection to a separate config variable, as my project env is setup automatically anyway, so adding support forconfiguring ycm is no problem.
I'd like (need) autocompletion for python3 scripts as well.
Would the 'ycmd' process have to be running python3 to do completion for python3 scripts? I thought that the completion data came from LLVM, so it shouldn't matter what the script driving LLVM is running, right?
Ie. would it be sufficient to set 'ft=python3' (or, perhaps better because of syntax HL, some YCM-variable instead) and have that filetype sent to ycmd so that this can use a different completion database?
+1, having an option like this would be excellent. The way that I've had to run and configure the ycm server at present is fairly tedious. For Python projects, I use Buildout
(somewhat similar to Virtualenv), and because that uses local modifications to the sys.path
to include packages, it doesn't play well with ycm. Being able to configure things at the Vim configuration level would be a real help.
+1
+1
+1
+1
+1
+1
For related issues in Jedi, which YouCompleteMe uses, see: https://github.com/davidhalter/jedi/issues/385, https://github.com/davidhalter/jedi/pull/539, https://github.com/davidhalter/jedi/issues/535 and https://github.com/davidhalter/jedi/pull/534.
How is state? Was there something implemented? I have the same problem: If I would like to jump to the definition of a method from an external module in my project it is not found.
Closed by PR #2205. See the Python Semantic Completion section from the documentation for details.
When editing certain projects, I change the python path in vim so the jedi works with those projects. There needs to be some way to manipulate the python path in ycmd.py.
The simplest would be just a config variable that is loaded on server startup. In which case I can set that config variable and restart ycmd when editing a project that needs a custom path.
A nicer, though somewhat hacky approach would be to monkey patch the insert, remove and append methods of sys.path in vim and pass in modifications to ycmd automatically. Of course, this will break if the user does assignment to sys.path or slicing instead of insert or append, but that is hopefully relative rare.