Python mode cleanup and pip-requirements package add.
Remove max line length from Python mode linter (use projects configuration files instead). Use the setup.cfg instead of pyproject.toml to compute the project root dir. Add the synxtaxic coloration for pip-requirements (pip-requirements package). Defer the lsp server startup.
This commit is contained in:
@@ -13,10 +13,21 @@
|
||||
;; lsp python customization
|
||||
(lsp-register-custom-settings
|
||||
'(("pylsp.plugins.pyls_mypy.enabled" t t)
|
||||
("pylsp.plugins.flake8.maxLineLength" 100)
|
||||
;; ("pylsp.plugins.flake8.maxLineLength" 100)
|
||||
;; ("pylsp.plugins.pycodestyle.maxLineLength" 100)
|
||||
("pylsp.plugins.yapf.enabled" t t)
|
||||
("pylsp.plugins.pylint.enabled" t t)))
|
||||
|
||||
;; locate the root pyproject.toml to force pylint rcfile
|
||||
;; (let* ((filename "pyproject.toml")
|
||||
(let* ((filename "setup.cfg")
|
||||
(found (locate-dominating-file default-directory filename)))
|
||||
(when found
|
||||
(let ((pyproject (format "%s%s" (replace-regexp-in-string "~" (getenv "HOME") found) filename)))
|
||||
(setq-local lsp-pylsp-plugins-pylint-args (vector (format "--rcfile=%s" pyproject))))))
|
||||
|
||||
(message (format "lsp-pylsp-plugins-pylint-args=%s" lsp-pylsp-plugins-pylint-args))
|
||||
|
||||
;; Enable virtualenv support.
|
||||
(when(feature-p 'pyvenv)
|
||||
(pyvenv-mode t))
|
||||
@@ -39,8 +50,8 @@
|
||||
:mode ("SCon\(struct\|script\)$" . python-mode)
|
||||
:interpreter ("python[0-9.]*" . python-mode)
|
||||
:hook
|
||||
(python-mode-hook . lsp)
|
||||
(python-mode-hook . user--python-mode-hook)
|
||||
(python-mode-hook . lsp-deferred)
|
||||
(python-mode-hook . (lambda ()
|
||||
(add-hook 'before-save-hook #'user--python-format-before-save nil t)))
|
||||
|
||||
@@ -56,8 +67,8 @@
|
||||
python-shell-interpreter-args ""
|
||||
python-shell-prompt-regexp "In \\[[0-9]+\\]: "
|
||||
python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
|
||||
python-shell-completion-setup-code "from IPython.core.completerlib import module_completion"
|
||||
python-shell-completion-string-code "';'.join(get_ipython().Completer.all_completions('''%s'''))\n"))
|
||||
python-shell-completion-setup-code "from IPython.core.completerlib import module_completion"))
|
||||
;; python-shell-completion-string-code "';'.join(get_ipython().Completer.all_completions('''%s'''))\n"))
|
||||
|
||||
(with-executable 'bpython
|
||||
(defun user/bpython-term()
|
||||
@@ -72,6 +83,14 @@
|
||||
;; https://github.com/pythonic-emacs/anaconda-mode
|
||||
;; Code navigation, documentation lookup and completion for Python.
|
||||
(use-package anaconda-mode)
|
||||
|
||||
;; https://github.com/Wilfred/pip-requirements.el
|
||||
;; Major mode for editing pip requirements files
|
||||
;; TODO: Find why completion does not run.
|
||||
(use-package pip-requirements
|
||||
:ensure t
|
||||
)
|
||||
|
||||
;; https://github.com/tsgates/pylookup
|
||||
;; Emacs mode for searching python documents with convenience
|
||||
(use-package pylookup
|
||||
|
Reference in New Issue
Block a user