Closed dtransposed closed 1 year ago
not related, but this should be the example for other bug reports. it's well described.
I have noticed super interesting thing.
Every time I run: pip install --upgrade jedi json-rpc service_factory
in the peen environment, the autocompletion starts suddenly working!
Then I restart emacs and autocompletion breaks! I run the pip install...
again and things are working once again.
This is weird.
@lebensterben Thank you!
Do you have virtual environment?
Yes. I am using pyenv.
For the purposes of this investigation I have created new environment testenv
pyenv-mode-set
.pip install --upgrade jedi json-rpc service_factory
is being run inside this virtual environment.Edit: anaconda-show-doc
also behaves funny, exactly like the autocompletion engine.
@dtransposed you use anaconda backend, which requires inferior python buffer created for auto-completion. Hence, first C-c C-p, then everything should work.
EDIT: Unfortunately, I can not find it in the anaconda documentation and it looks like it should work right away, but at the times I was using it, I had such problem, until the inferior-python-buffer is started.
@alexey0308 Thank you! It works like charm! Could you explain why this is the case? Do other backends have different behaviour?
Line 102 probably need to be changed to :modes python-mode inferior-python-mode
for anaconda
backend.
LSP starts its server automatically in the background, but you need to restart it if you activate the environment, so it catches up with the new configuration. I don't use anaconda anymore and I don't remember, where actually I read, that one needs to have a python process for anaconda to work. Maybe check the source code or docs or take it as a folklore knowledge :)
But it's actually handled here: https://github.com/syl20bnr/spacemacs/blob/3371a8220c8e48503dc6dd4e2d6ac532ba9946ad/layers/%2Blang/python/funcs.el#L64-L71
(If we drop support of all non-lsp backends, life would be much easier for all of us)
Line 102 probably need to be changed to
:modes python-mode inferior-python-mode
foranaconda
backend.
@lebensterben this is for inferior buffer only: it is always on anaconda backend, regardless of lsp or not for the python-mode. For python-mode, you already found anaconda configuration in your second message.
(If we drop support of all non-lsp backends, life would be much easier for all of us)
Anaconda can work with tramp AFAIK, I don't know if lsp as well?
Anaconda can work with tramp AFAIK, I don't know if lsp as well?
A valid point. Setting up LSP over remote connection is doable, and I've actually seen someone mentioned this a few days ago. But it requires some setups.
See https://emacs-lsp.github.io/lsp-mode/page/remote/
But I really wish we can drop non-lsp support, for its many benefits:
I understand, it's more work to support it, especially when there is no dedicated maintainer for every layer. But it's rather a political decision: you see people using anaconda for some reason, or e.g. I use ess because I like to have completion based on the inferior buffer state as well, and lsp infers only based on the code base, right? Trade-off between maintaining and users ¯_(ツ)_/¯
One point against LSP is that it normally takes much more system load than traditional emacs modes. Still the ecosystem definitely goes into the direction of LSP. I dimly remember we already have layers supporting only LSP right now.
Please retry with one of the LSP backend.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Description
Autocompletion is not working for a code written in a script, however it works for Inferior Python.
Reproduction guide
.py
)pyenv-mode-set
, tested module isnumpy
, although I tried also withtime
)Observed behaviour Completions do not work.
company-diag
returns the log:However, when performing same import and autocompletion in inferior mode (
run-python
), autocompletion works as expected.company-diag
returns the log:System Info
OS: darwin20.1.0 Emacs: 27.1 Spacemacs: 0.300.0 Spacemacs branch:
Distribution: spacemacs Editing style: vim Completion: helm Layers:
I have tried solutions listed in following issues: https://github.com/syl20bnr/spacemacs/issues/11785 https://github.com/syl20bnr/spacemacs/issues/10638
Namely:
dotspacemacs-additional-packages '(jedi)
Nothing works for me so far.