Browse Source

added language server protocol for python

master
Marc Pohling 6 years ago
parent
commit
b32ce23318
1 changed files with 43 additions and 2 deletions
  1. 45
      config.org

45
config.org

@ -1103,8 +1103,8 @@ Common backends are:
#+BEGIN_SRC emacs-lisp
(defun company/python-mode-hook()
(set (make-local-variable 'company-backends)
'((company-jedi company-dabbrev company-yasnippet) company-capf company-files))
;; '((company-jedi company-dabbrev) company-capf company-files))
; '((company-jedi company-dabbrev-code company-yasnippet) company-capf company-files))
'((company-lsp company-yasnippet) company-capf company-dabbrev company-files))
(company-mode t)
)
#+END_SRC
@ -1252,9 +1252,14 @@ Add some helpers to handle and understand macros
- venv
The virtual environments need to have following modules installed:
- wheel (for some reason it isn't pulled by other packages, yet they complain about missing wheel)
- jedi
- epc
- pylint
- NEW: python-language-server[all]
- instead of [all] there are
for python-language-server see here: [[https://github.com/palantir/python-language-server][Link]]
Automatically start python-mode when opening a .py-file.
Not sure if python.el is better than python-mode.el.
@ -1278,6 +1283,42 @@ Add some helpers to handle and understand macros
)
#+END_SRC
First test for lsp-python.
Source python language server: [[https://github.com/palantir/python-language-server][Link]]
Source lsp-mode:
Source lsp-python: [[https://github.com/emacs-lsp/lsp-python][Link]]
Source company-lsp: [[https://github.com/tigersoldier/company-lsp][Link]]
Source lsp-ui: [[https://github.com/emacs-lsp/lsp-ui][Link]]
#+BEGIN_SRC emacs-lisp
(use-package lsp-mode
:ensure t
:defer t)
(add-hook 'lsp-mode-hook #'(lambda ()
(customize-set-variable 'lsp-enable-eldoc nil)
(flycheck-mode 1)
(company-mode 1)))
(use-package lsp-ui
:ensure t
:defer t)
(use-package company-lsp
:ensure t
:defer t)
(use-package lsp-python
:ensure t
:after lsp-mode
:defer t
:init
(add-hook 'python-mode-hook #'(lambda ()
(lsp-python-enable)
(flycheck-select-checker 'python-flake8))))
#+END_SRC
Jedi is a backend for python autocompletion and needs to be installed on the server:
- pip install jedi

Loading…
Cancel
Save