Change back to eglot and flymake
This commit is contained in:
parent
95719dabf0
commit
f3b3d60363
249
init.el
249
init.el
@ -347,8 +347,8 @@ visual states."
|
||||
(defun my/consult-setup-minibuffer-completion ()
|
||||
(setq-local completion-in-region-function #'consult-completion-in-region))
|
||||
(evil-declare-motion #'consult-line))
|
||||
;; (use-package consult-eglot
|
||||
;; :commands consult-eglot-symbols)
|
||||
(use-package consult-eglot
|
||||
:commands consult-eglot-symbols)
|
||||
|
||||
;; integration for embark and consult
|
||||
(use-package embark-consult
|
||||
@ -406,30 +406,30 @@ visual states."
|
||||
(use-package posframe)
|
||||
|
||||
;; flymake
|
||||
;; (use-package flymake
|
||||
;; :bind (:map flymake-mode-map
|
||||
;; ("C-c e" . my/flymake-show-diagnostic-at-point)
|
||||
;; ("C-c C-e" . consult-flymake))
|
||||
;; ;; :hook (emacs-lisp-mode . flymake-mode)
|
||||
;; :init
|
||||
;; (defun my/flymake-show-diagnostic-at-point ()
|
||||
;; (interactive)
|
||||
;; (if-let ((pos (point))
|
||||
;; (diag (and flymake-mode
|
||||
;; (get-char-property pos 'flymake-diagnostic)))
|
||||
;; (message (flymake--diag-text diag)))
|
||||
;; (if (display-graphic-p)
|
||||
;; (progn
|
||||
;; (posframe-show " *flymake-error-posframe*"
|
||||
;; :string message
|
||||
;; :position (point)
|
||||
;; :max-width 80
|
||||
;; :border-width 2
|
||||
;; :border-color "white")
|
||||
;; (clear-this-command-keys)
|
||||
;; (push (read-event) unread-command-events)
|
||||
;; (posframe-hide " *flymake-error-posframe*"))
|
||||
;; (popup-tip message)))))
|
||||
(use-package flymake
|
||||
:bind (:map flymake-mode-map
|
||||
("C-c e" . my/flymake-show-diagnostic-at-point)
|
||||
("C-c C-e" . consult-flymake))
|
||||
:hook (emacs-lisp-mode . flymake-mode)
|
||||
:init
|
||||
(defun my/flymake-show-diagnostic-at-point ()
|
||||
(interactive)
|
||||
(if-let ((pos (point))
|
||||
(diag (and flymake-mode
|
||||
(get-char-property pos 'flymake-diagnostic)))
|
||||
(message (flymake--diag-text diag)))
|
||||
(if (display-graphic-p)
|
||||
(progn
|
||||
(posframe-show " *flymake-error-posframe*"
|
||||
:string message
|
||||
:position (point)
|
||||
:max-width 80
|
||||
:border-width 2
|
||||
:border-color "white")
|
||||
(clear-this-command-keys)
|
||||
(push (read-event) unread-command-events)
|
||||
(posframe-hide " *flymake-error-posframe*"))
|
||||
(popup-tip message)))))
|
||||
|
||||
;; eldoc
|
||||
(use-package eldoc
|
||||
@ -443,104 +443,104 @@ visual states."
|
||||
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
|
||||
|
||||
;; eglot
|
||||
;; (use-package eglot
|
||||
;; :demand t
|
||||
;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
|
||||
;; latex-mode markdown-mode blueprint-ts-mode) . eglot-ensure)
|
||||
;; (eglot-managed-mode . my/-eglot-setup))
|
||||
;; :init
|
||||
;; (defvar my/-eglot-documentation-buffer nil
|
||||
;; "Buffer for showing documentation for `my/eglot-documentation-at-point'.")
|
||||
;; (defun my/eglot-documentation-at-point ()
|
||||
;; "Show documentation for a symbol at point."
|
||||
;; (interactive)
|
||||
;; (if-let (server (eglot-current-server))
|
||||
;; (progn
|
||||
;; (if-let* (((not (buffer-live-p my/-eglot-documentation-buffer)))
|
||||
;; (name (generate-new-buffer-name "*eglot documentation*")))
|
||||
;; (setq my/-eglot-documentation-buffer (generate-new-buffer name)))
|
||||
;; (eglot-hover-eldoc-function
|
||||
;; (lambda (info _ _)
|
||||
;; (if-let (((not (seq-empty-p info)))
|
||||
;; (buff (current-buffer)))
|
||||
;; (with-current-buffer my/-eglot-documentation-buffer
|
||||
;; (read-only-mode -1)
|
||||
;; (erase-buffer)
|
||||
;; (insert info)
|
||||
;; (special-mode)
|
||||
;; (read-only-mode 1)
|
||||
;; (when (not (get-buffer-window my/-eglot-documentation-buffer nil))
|
||||
;; (switch-to-buffer-other-window my/-eglot-documentation-buffer t)
|
||||
;; (switch-to-buffer-other-window buff t)))))))))
|
||||
;; (defun my/-eglot-setup ()
|
||||
;; "Setup eldoc variables for `eglot-managed-mode-hook'."
|
||||
;; (setq-local eldoc-echo-area-use-multiline-p nil
|
||||
;; evil-lookup-func #'my/eglot-documentation-at-point)
|
||||
;; (evil-define-key '(normal motion) 'local
|
||||
;; "K" #'evil-lookup
|
||||
;; "gR" #'eglot-rename
|
||||
;; "gA" #'eglot-code-actions
|
||||
;; "gs" #'consult-eglot-symbols)
|
||||
;; (eglot-inlay-hints-mode -1))
|
||||
;; (setq eglot-autoshutdown t)
|
||||
;; :config
|
||||
;; (add-to-list 'eglot-server-programs
|
||||
;; (cons '(c-mode c-ts-mode c++-mode c++-ts-mode objc-mode)
|
||||
;; '("clangd" "--all-scopes-completion" "--background-index"
|
||||
;; "--clang-tidy" "--completion-style=detailed"
|
||||
;; "--header-insertion=never" "--pch-storage=memory"
|
||||
;; "--malloc-trim" "--function-arg-placeholders"))))
|
||||
(use-package eglot
|
||||
:demand t
|
||||
:hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
|
||||
latex-mode markdown-mode blueprint-ts-mode) . eglot-ensure)
|
||||
(eglot-managed-mode . my/-eglot-setup))
|
||||
:init
|
||||
(defvar my/-eglot-documentation-buffer nil
|
||||
"Buffer for showing documentation for `my/eglot-documentation-at-point'.")
|
||||
(defun my/eglot-documentation-at-point ()
|
||||
"Show documentation for a symbol at point."
|
||||
(interactive)
|
||||
(if-let (server (eglot-current-server))
|
||||
(progn
|
||||
(if-let* (((not (buffer-live-p my/-eglot-documentation-buffer)))
|
||||
(name (generate-new-buffer-name "*eglot documentation*")))
|
||||
(setq my/-eglot-documentation-buffer (generate-new-buffer name)))
|
||||
(eglot-hover-eldoc-function
|
||||
(lambda (info _ _)
|
||||
(if-let (((not (seq-empty-p info)))
|
||||
(buff (current-buffer)))
|
||||
(with-current-buffer my/-eglot-documentation-buffer
|
||||
(read-only-mode -1)
|
||||
(erase-buffer)
|
||||
(insert info)
|
||||
(special-mode)
|
||||
(read-only-mode 1)
|
||||
(when (not (get-buffer-window my/-eglot-documentation-buffer nil))
|
||||
(switch-to-buffer-other-window my/-eglot-documentation-buffer t)
|
||||
(switch-to-buffer-other-window buff t)))))))))
|
||||
(defun my/-eglot-setup ()
|
||||
"Setup eldoc variables for `eglot-managed-mode-hook'."
|
||||
(setq-local eldoc-echo-area-use-multiline-p nil
|
||||
evil-lookup-func #'my/eglot-documentation-at-point)
|
||||
(evil-define-key '(normal motion) 'local
|
||||
"K" #'evil-lookup
|
||||
"gR" #'eglot-rename
|
||||
"gA" #'eglot-code-actions
|
||||
"gs" #'consult-eglot-symbols)
|
||||
(eglot-inlay-hints-mode -1))
|
||||
(setq eglot-autoshutdown t)
|
||||
:config
|
||||
(add-to-list 'eglot-server-programs
|
||||
(cons '(c-mode c-ts-mode c++-mode c++-ts-mode objc-mode)
|
||||
'("clangd" "--all-scopes-completion" "--background-index"
|
||||
"--clang-tidy" "--completion-style=detailed"
|
||||
"--header-insertion=never" "--pch-storage=memory"
|
||||
"--malloc-trim" "--function-arg-placeholders"))))
|
||||
|
||||
;; flycheck
|
||||
(use-package flycheck
|
||||
:hook (emacs-lisp-mode . flycheck-mode)
|
||||
:bind (:map flycheck-mode-map
|
||||
("C-c e" . my/flycheck-show-diagnostic-at-point))
|
||||
:init
|
||||
(setq flycheck-display-errors-function nil)
|
||||
(defun my/flycheck-show-diagnostic-at-point ()
|
||||
(interactive)
|
||||
(if-let ((flycheck-mode)
|
||||
(errors (flycheck-overlay-errors-at (point)))
|
||||
(message (apply 'concat
|
||||
(mapcar
|
||||
(lambda (error)
|
||||
(concat "•" (flycheck-error-message error) "\n"))
|
||||
errors))))
|
||||
(if (display-graphic-p)
|
||||
(progn
|
||||
(posframe-show " *flycheck-error-posframe*"
|
||||
:string message
|
||||
:position (point)
|
||||
:max-width 80
|
||||
:border-width 2
|
||||
:border-color "white")
|
||||
(clear-this-command-keys)
|
||||
(push (read-event) unread-command-events)
|
||||
(posframe-hide " *flycheck-error-posframe*"))
|
||||
(popup-tip message)))))
|
||||
(use-package consult-flycheck
|
||||
:bind (:map flycheck-mode-map
|
||||
("C-c C-e" . consult-flycheck)))
|
||||
;; (use-package flycheck
|
||||
;; :hook (emacs-lisp-mode . flycheck-mode)
|
||||
;; :bind (:map flycheck-mode-map
|
||||
;; ("C-c e" . my/flycheck-show-diagnostic-at-point))
|
||||
;; :init
|
||||
;; (setq flycheck-display-errors-function nil)
|
||||
;; (defun my/flycheck-show-diagnostic-at-point ()
|
||||
;; (interactive)
|
||||
;; (if-let ((flycheck-mode)
|
||||
;; (errors (flycheck-overlay-errors-at (point)))
|
||||
;; (message (apply 'concat
|
||||
;; (mapcar
|
||||
;; (lambda (error)
|
||||
;; (concat "•" (flycheck-error-message error) "\n"))
|
||||
;; errors))))
|
||||
;; (if (display-graphic-p)
|
||||
;; (progn
|
||||
;; (posframe-show " *flycheck-error-posframe*"
|
||||
;; :string message
|
||||
;; :position (point)
|
||||
;; :max-width 80
|
||||
;; :border-width 2
|
||||
;; :border-color "white")
|
||||
;; (clear-this-command-keys)
|
||||
;; (push (read-event) unread-command-events)
|
||||
;; (posframe-hide " *flycheck-error-posframe*"))
|
||||
;; (popup-tip message)))))
|
||||
;; (use-package consult-flycheck
|
||||
;; :bind (:map flycheck-mode-map
|
||||
;; ("C-c C-e" . consult-flycheck)))
|
||||
|
||||
;; lsp-mode
|
||||
(use-package consult-lsp)
|
||||
(use-package lsp-mode
|
||||
:hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
|
||||
latex-mode markdown-mode blueprint-ts-mode) . lsp-mode)
|
||||
(lsp-mode . my/-setup-lsp-mode-buffer))
|
||||
:init
|
||||
(setq lsp-completion-provider :none
|
||||
lsp-headerline-breadcrumb-enable nil
|
||||
lsp-inlay-hint-enable nil
|
||||
lsp-signature-doc-lines 1)
|
||||
(defun my/-setup-lsp-mode-buffer ()
|
||||
"Called by `lsp-mode-hook' to setup lsp-mode buffers."
|
||||
(evil-define-key '(normal visual motion) 'local
|
||||
"gR" #'lsp-rename
|
||||
"gA" #'lsp-execute-code-action
|
||||
"gs" #'consult-lsp-symbols)
|
||||
(setq-local evil-lookup-func #'lsp-describe-thing-at-point)))
|
||||
;; (use-package consult-lsp)
|
||||
;; (use-package lsp-mode
|
||||
;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
|
||||
;; latex-mode markdown-mode blueprint-ts-mode) . lsp-mode)
|
||||
;; (lsp-mode . my/-setup-lsp-mode-buffer))
|
||||
;; :init
|
||||
;; (setq lsp-completion-provider :none
|
||||
;; lsp-headerline-breadcrumb-enable nil
|
||||
;; lsp-inlay-hint-enable nil
|
||||
;; lsp-signature-doc-lines 1)
|
||||
;; (defun my/-setup-lsp-mode-buffer ()
|
||||
;; "Called by `lsp-mode-hook' to setup lsp-mode buffers."
|
||||
;; (evil-define-key '(normal visual motion) 'local
|
||||
;; "gR" #'lsp-rename
|
||||
;; "gA" #'lsp-execute-code-action
|
||||
;; "gs" #'consult-lsp-symbols)
|
||||
;; (setq-local evil-lookup-func #'lsp-describe-thing-at-point)))
|
||||
|
||||
;; yasnippet
|
||||
(use-package yasnippet
|
||||
@ -645,13 +645,12 @@ COMMAND and COMINT are like `compile'."
|
||||
(use-package markdown-mode)
|
||||
|
||||
;; cmake
|
||||
(use-package cmake-mode
|
||||
:ensure nil
|
||||
:hook (cmake-ts-mode . my/setup-cmake-ts-mode)
|
||||
:init
|
||||
(require 'cmake-mode)
|
||||
(with-eval-after-load 'cmake-mode
|
||||
(defun my/setup-cmake-ts-mode ()
|
||||
"Setup `cmake-ts-mode' buffers."
|
||||
(setq-local indent-line-function #'cmake-indent)))
|
||||
(setq-local indent-line-function #'cmake-indent))
|
||||
(add-hook 'cmake-ts-mode-hook #'my/setup-cmake-ts-mode))
|
||||
|
||||
;; json
|
||||
(use-package json-mode)
|
||||
|
Loading…
Reference in New Issue
Block a user