emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.05k stars 141 forks source link

flymake-diagnostic-at-point #210

Open arkhan opened 5 years ago

arkhan commented 5 years ago

Regards, I have a question, since lsp-mode is going to give preference to flymake it could be considered: https://github.com/meqif/flymake-diagnostic-at-point thanks

MaskRay commented 5 years ago

I'm currently using this configuration:

(after! flymake-proc
  ;; disable flymake-proc
  (setq-default flymake-diagnostic-functions nil)
  )
(defvar flymake-posframe-delay 0.5)
(defvar flymake-posframe-buffer "*flymake-posframe*")
(defvar-local flymake-posframe--timer nil)
(defvar-local flymake-posframe--last-diag nil)

(defun flymake-posframe-hide ()
  (posframe-hide flymake-posframe-buffer))

(defun flymake-posframe-display ()
  (when flymake-mode
    (if-let (diag (and flymake-mode
                       (get-char-property (point) 'flymake-diagnostic)))
        (unless (and (eq diag flymake-posframe--last-diag)
                     (frame-visible-p (buffer-local-value 'posframe--frame (get-buffer flymake-posframe-buffer))))
          (setq flymake-posframe--last-diag diag)
          (posframe-show
           flymake-posframe-buffer
           :string (propertize (concat "➤ " (flymake--diag-text diag))
                               'face
                               (case (flymake--diag-type diag)
                                 (:error 'error)
                                 (:warning 'warning)
                                 (:note 'info)))))
      (flymake-posframe-hide))))

(add-hook 'post-command-hook #'flymake-posframe-set-timer)
(add-hook! (doom-exit-buffer doom-exit-window) #'flymake-posframe-hide)
arkhan commented 5 years ago

my question is if you can integrate something similar to the sideline

yyoncho commented 5 years ago

As a side note, we will make sideline errors work for flymake as well.

jefftrull commented 5 years ago

Very interested in that feature. I just switched to flymake and... no error messages, just markers. Would like to see the explanation - even if only when I hover on the line.

yilinwei commented 3 years ago

@jefftrull

You can get the error by using flymake-goto-next/prev-error. It echoes in the mini-buffer at the bottom. Not as nice as a hover, but it works OK.