[Emacs] Basic python lsp support

This commit is contained in:
Ivan Malison 2019-01-11 13:40:03 -08:00
parent 77a92ce21c
commit 8687bc3518
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -2205,12 +2205,13 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
<<programminglanguages>> <<programminglanguages>>
*** python *** python
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defvar imalison:use-lsp-python t)
(use-package python (use-package python
:commands python-mode :commands python-mode
:mode ("\\.py\\'" . python-mode) :mode ("\\.py\\'" . python-mode)
:preface :preface
(defun imalison:python-mode () (progn
(setq show-trailing-whitespace t) (defun imalison:jedi-setup ()
;; TODO: This was likely fixed and can probably be removed ;; TODO: This was likely fixed and can probably be removed
;; Somehow this is sometimes set to jedi:ac-setup which we ;; Somehow this is sometimes set to jedi:ac-setup which we
;; don't want. This binding avoids starting auto-complete mode. ;; don't want. This binding avoids starting auto-complete mode.
@ -2220,15 +2221,17 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
;; XXX: This has become pretty annoying ;; XXX: This has become pretty annoying
;; (add-hook 'before-save-hook 'pyimport-remove-unused t t) ;; (add-hook 'before-save-hook 'pyimport-remove-unused t t)
;; Ensure company is active
(company-mode +1)
;; Only use company-jedi for completion ;; Only use company-jedi for completion
(set (make-local-variable 'company-backends) '(company-jedi)) (set (make-local-variable 'company-backends) '(company-jedi)))
(defun imalison:python-mode ()
(setq show-trailing-whitespace t)
;; Remove default python completion, as we are going to rely on ;; Remove default python completion, as we are going to rely on
;; company-jedi. ;; company-jedi or company-lsp.
(remove-hook 'completion-at-point-functions ;; (remove-hook 'completion-at-point-functions
'python-completion-complete-at-point 'local)) ;; 'python-completion-complete-at-point 'local)
(unless imalison:use-lsp-python
(imalison:jedi-setup))))
:config :config
(progn (progn
(use-package sphinx-doc) (use-package sphinx-doc)