Emacs: Check if lsp-ui was loaded

This commit is contained in:
Joseph Ferano 2024-10-08 15:08:34 +07:00
parent ceb2bb0d3c
commit 8a275aea95

View File

@ -2261,27 +2261,10 @@ These help speed eglot up apparently [[https://www.reddit.com/r/emacs/comments/1
(evil-global-set-key 'normal (kbd "SPC lD") #'consult-lsp-diagnostics)
(evil-global-set-key 'normal (kbd "SPC lf") #'consult-lsp-file-symbols))
;; This function allows us to extract Rust's true function signature
;; (cl-defmethod lsp-clients-extract-signature-on-hover (contents (_server-id (eql rust-analyzer)))
;; (-let* (((&hash "value") contents)
;; (groups (--partition-by (s-blank? it) (s-lines (s-trim value))))
;; (sig_group (if (s-equals? "```rust" (car (-third-item groups)))
;; (-third-item groups)
;; (car groups)))
;; (sig (--> sig_group
;; (--drop-while (s-equals? "```rust" it) it)
;; (--take-while (not (s-equals? "```" it)) it)
;; (--map (s-trim it) it)
;; (s-join " " it))))
;; (lsp--render-element (concat "```rust\n" sig "\n```")))
;; (require 'lsp-ui)
#+end_src
*** Flycheck
#+begin_src emacs-lisp
;; TODO Add wrapping to these functions
(require 'flycheck)
(setq flycheck-check-syntax-automatically '())
(setq flycheck-keymap-prefix (kbd "C-c e"))
@ -2291,8 +2274,9 @@ These help speed eglot up apparently [[https://www.reddit.com/r/emacs/comments/1
(defun joe/flycheck-clear ()
(interactive)
(flycheck-clear)
(lsp-ui-sideline--erase))
(when (boundp 'lsp-ui)
(flycheck-clear)
(lsp-ui-sideline--erase)))
(add-hook 'after-save-hook #'joe/flycheck-clear)