Skip to content

Commit

Permalink
Apheleia and Python fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasdrp committed Oct 31, 2024
1 parent a35bb32 commit 009f729
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 38 deletions.
28 changes: 9 additions & 19 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -1813,8 +1813,7 @@ debian, and derivatives). On most it's 'fd'.")
(lsp-enable-imenu nil)
(lsp-enable-snippet nil)
(lsp-enable-dap-auto-configure nil)
(lsp-disabled-clients '((python-mode . pyls)))

(lsp-disabled-clients '((python-mode . pyls) (python-ts-mode . pyls)))
;; Rust-analyzer is the almost official lsp server for Rust
(lsp-rust-server 'rust-analyzer)
(lsp-rust-analyzer-cargo-watch-command "clippy")
Expand Down Expand Up @@ -1926,24 +1925,14 @@ debian, and derivatives). On most it's 'fd'.")
(prog-mode . pokemacs-clear-compilation-finish-functions))

(use-package apheleia
:hook
(c-mode . apheleia-mode)
(c++-mode . apheleia-mode)
(caml-mode . apheleia-mode)
(elm-mode . apheleia-mode)
(java-mode . apheleia-mode)
(fsharp-mode . apheleia-mode)
(kotlin-mode . apheleia-mode)
(python-mode . apheleia-mode)
(enh-ruby-mode . apheleia-mode)
(rustic-mode . apheleia-mode)
(rust-ts-mode . apheleia-mode)
(tuareg-mode . apheleia-mode)
:init (apheleia-global-mode +1)
:config
(setf (alist-get 'isort apheleia-formatters)
'("isort" "--stdout" "-"))
(setf (alist-get 'python-mode apheleia-mode-alist)
'(isort black))
(setf (alist-get 'python-ts-mode apheleia-mode-alist)
'(isort black))
(push '(enh-ruby-mode . rubocop) apheleia-mode-alist)
(message "`apheleia' loaded"))

Expand Down Expand Up @@ -3336,7 +3325,7 @@ DIR and GIVEN-INITIAL match the method signature of `consult-wrapper'."
:ensure (ts-fold :host github :repo "emacs-tree-sitter/ts-fold")
:hook
(tuareg-mode . ts-fold-mode)
(c-mode . ts-fold-mode)
(c-mode . ts-fold-mode)
(c++-mode . ts-fold-mode)
(python-mode . ts-fold-mode)
(rustic-mode . ts-fold-mode)
Expand All @@ -3356,6 +3345,7 @@ DIR and GIVEN-INITIAL match the method signature of `consult-wrapper'."
(message "`ts-fold-indicators' loaded"))

(use-package combobulate
:disabled
:after treesit
:preface
;; You can customize Combobulate's key prefix here.
Expand Down Expand Up @@ -3989,7 +3979,7 @@ DIR and GIVEN-INITIAL match the method signature of `consult-wrapper'."
(when use-python
(use-package python
:ensure nil
:hook (python-mode . semantic-mode)
:hook (python-ts-mode . semantic-mode)
:config
;; Remove guess indent python message
(setq python-indent-guess-indent-offset-verbose nil)
Expand All @@ -4010,7 +4000,7 @@ DIR and GIVEN-INITIAL match the method signature of `consult-wrapper'."

(when use-python
(use-package pyvenv
:hook (python-mode . pyvenv-mode)
:hook (python-ts-mode . pyvenv-mode)
:config
;; Setting work on to easily switch between environments
(setenv "WORKON_HOME" (expand-file-name "~/miniconda3/envs/"))
Expand All @@ -4024,7 +4014,7 @@ DIR and GIVEN-INITIAL match the method signature of `consult-wrapper'."
(when use-python
(use-package lsp-pyright
:after (python lsp-mode)
:hook (python-mode . (lambda ()
:hook (python-ts-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred)))
:config
Expand Down
28 changes: 9 additions & 19 deletions init.org
Original file line number Diff line number Diff line change
Expand Up @@ -3036,8 +3036,7 @@ Minor mode acting as a client between a language server protocol and emacs.
(lsp-enable-imenu nil)
(lsp-enable-snippet nil)
(lsp-enable-dap-auto-configure nil)
(lsp-disabled-clients '((python-mode . pyls)))

(lsp-disabled-clients '((python-mode . pyls) (python-ts-mode . pyls)))
;; Rust-analyzer is the almost official lsp server for Rust
(lsp-rust-server 'rust-analyzer)
(lsp-rust-analyzer-cargo-watch-command "clippy")
Expand Down Expand Up @@ -3193,24 +3192,14 @@ Asynchronous code formatting after saving files.

#+begin_src emacs-lisp
(use-package apheleia
:hook
(c-mode . apheleia-mode)
(c++-mode . apheleia-mode)
(caml-mode . apheleia-mode)
(elm-mode . apheleia-mode)
(java-mode . apheleia-mode)
(fsharp-mode . apheleia-mode)
(kotlin-mode . apheleia-mode)
(python-mode . apheleia-mode)
(enh-ruby-mode . apheleia-mode)
(rustic-mode . apheleia-mode)
(rust-ts-mode . apheleia-mode)
(tuareg-mode . apheleia-mode)
:init (apheleia-global-mode +1)
:config
(setf (alist-get 'isort apheleia-formatters)
'("isort" "--stdout" "-"))
(setf (alist-get 'python-mode apheleia-mode-alist)
'(isort black))
(setf (alist-get 'python-ts-mode apheleia-mode-alist)
'(isort black))
(push '(enh-ruby-mode . rubocop) apheleia-mode-alist)
(message "`apheleia' loaded"))
#+end_src
Expand Down Expand Up @@ -5085,7 +5074,7 @@ Code folding based on tree-sitter tree.
:ensure (ts-fold :host github :repo "emacs-tree-sitter/ts-fold")
:hook
(tuareg-mode . ts-fold-mode)
(c-mode . ts-fold-mode)
(c-mode . ts-fold-mode)
(c++-mode . ts-fold-mode)
(python-mode . ts-fold-mode)
(rustic-mode . ts-fold-mode)
Expand Down Expand Up @@ -5113,6 +5102,7 @@ Code folding based on tree-sitter tree.

#+begin_src emacs-lisp
(use-package combobulate
:disabled
:after treesit
:preface
;; You can customize Combobulate's key prefix here.
Expand Down Expand Up @@ -6002,7 +5992,7 @@ In order to use this package you need to run ~M-x pdf-tools-install~ the first t
(when use-python
(use-package python
:ensure nil
:hook (python-mode . semantic-mode)
:hook (python-ts-mode . semantic-mode)
:config
;; Remove guess indent python message
(setq python-indent-guess-indent-offset-verbose nil)
Expand Down Expand Up @@ -6033,7 +6023,7 @@ Setting the ~WORKON_HOME~ environment variable points at where the envs are loca
#+begin_src emacs-lisp
(when use-python
(use-package pyvenv
:hook (python-mode . pyvenv-mode)
:hook (python-ts-mode . pyvenv-mode)
:config
;; Setting work on to easily switch between environments
(setenv "WORKON_HOME" (expand-file-name "~/miniconda3/envs/"))
Expand All @@ -6058,7 +6048,7 @@ Read the docs for the different variables set in the config.
(when use-python
(use-package lsp-pyright
:after (python lsp-mode)
:hook (python-mode . (lambda ()
:hook (python-ts-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred)))
:config
Expand Down

0 comments on commit 009f729

Please sign in to comment.