[Emacs] Basic python lsp support
This commit is contained in:
parent
77a92ce21c
commit
8687bc3518
@ -2205,35 +2205,38 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
|
||||
<<programminglanguages>>
|
||||
*** python
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defvar imalison:use-lsp-python t)
|
||||
(use-package python
|
||||
:commands python-mode
|
||||
:mode ("\\.py\\'" . python-mode)
|
||||
:preface
|
||||
(defun imalison:python-mode ()
|
||||
(setq show-trailing-whitespace t)
|
||||
;; TODO: This was likely fixed and can probably be removed
|
||||
;; Somehow this is sometimes set to jedi:ac-setup which we
|
||||
;; don't want. This binding avoids starting auto-complete mode.
|
||||
(let ((jedi:setup-function nil))
|
||||
(jedi:setup))
|
||||
(progn
|
||||
(defun imalison:jedi-setup ()
|
||||
;; TODO: This was likely fixed and can probably be removed
|
||||
;; Somehow this is sometimes set to jedi:ac-setup which we
|
||||
;; don't want. This binding avoids starting auto-complete mode.
|
||||
(let ((jedi:setup-function nil))
|
||||
(jedi:setup))
|
||||
|
||||
;; XXX: This has become pretty annoying
|
||||
;; (add-hook 'before-save-hook 'pyimport-remove-unused t t)
|
||||
;; XXX: This has become pretty annoying
|
||||
;; (add-hook 'before-save-hook 'pyimport-remove-unused t t)
|
||||
|
||||
;; Ensure company is active
|
||||
(company-mode +1)
|
||||
;; Only use company-jedi for completion
|
||||
(set (make-local-variable 'company-backends) '(company-jedi))
|
||||
;; Only use company-jedi for completion
|
||||
(set (make-local-variable 'company-backends) '(company-jedi)))
|
||||
|
||||
;; Remove default python completion, as we are going to rely on
|
||||
;; company-jedi.
|
||||
(remove-hook 'completion-at-point-functions
|
||||
'python-completion-complete-at-point 'local))
|
||||
(defun imalison:python-mode ()
|
||||
(setq show-trailing-whitespace t)
|
||||
;; Remove default python completion, as we are going to rely on
|
||||
;; company-jedi or company-lsp.
|
||||
;; (remove-hook 'completion-at-point-functions
|
||||
;; 'python-completion-complete-at-point 'local)
|
||||
(unless imalison:use-lsp-python
|
||||
(imalison:jedi-setup))))
|
||||
:config
|
||||
(progn
|
||||
(use-package sphinx-doc)
|
||||
(unbind-key "C-j" python-mode-map)
|
||||
(add-hook 'python-mode-hook #'imalison:python-mode)))
|
||||
(use-package sphinx-doc)
|
||||
(unbind-key "C-j" python-mode-map)
|
||||
(add-hook 'python-mode-hook #'imalison:python-mode)))
|
||||
#+END_SRC
|
||||
**** pippel
|
||||
pippel lets one manage pip packages
|
||||
|
Loading…
Reference in New Issue
Block a user