emacs-sideline / sideline-lsp

Show lsp information with sideline
GNU General Public License v3.0
14 stars 4 forks source link

sideline not showing warnings-errors only fixes #2

Open innerout opened 1 year ago

innerout commented 1 year ago

Hi jcs, First of all, thanks for the great plugin. I have been looking for this kind of feature for quite some time to use in emacs. I am trying to setup sideline with sideline-flycheck and sideline-lsp, and I cannot find a way to make the errors show up as in the images you have in the sideline package.

I have enabled sideline-mode by manually calling it in the buffer, and I have the following in my configuration.

I have tried adding sideline-flycheck in the backend, but it still showed nothing. Do you know what could happen that would result in this behavior? I am using emacs 28 with native-comp (with doom emacs) and tried to port your leaf suggestions to use-package.

(use-package! sideline
  :hook (flycheck-mode-hook . sideline-mode)
  :init
  (setq    sideline-order-left 'down              ; or 'up
    sideline-order-right 'up               ; or 'down
    sideline-format-left "%s   "           ; format for left aligment
    sideline-format-right "   %s"          ; format for right aligment
    sideline-priority 100                  ; overlays' priority
    sideline-display-backend-name t)       ; display the backend name
  (setq sideline-backends-right '(sideline-lsp)))

(use-package! sideline-lsp
  :init
  (setq sideline-lsp-update-mode 'line))

(use-package! lsp-mode :hook (lsp-mode-hook . sideline-mode))
(use-package! lsp-ui :init (setq lsp-ui-sideline-enable nil))  ; disable original sideline
(use-package! sideline-flycheck :hook (flycheck-mode-hook . sideline-flycheck-setup))

The image shows what I am seeing. The asd error is not displayed at all nor the clang-tidy warnings. The clang-tidy warnings come from the lsp-server. (clangd) image

jcs090218 commented 1 year ago

You should have all backends in sideline-backends-right. Therefore,

(setq sideline-backends-right '(sideline-lsp sideline-flycheck))
innerout commented 1 year ago

I applied your change, but I got the same behavior.

jcs090218 commented 1 year ago

What's your value lsp-prefer-flymake? Are you using flymake or flycheck?

innerout commented 1 year ago

When running describe-variable in a buffer that has lsp-activated there is no such option. Is there a case I am in an old lsp-mode?

jcs090218 commented 1 year ago

Sorry for the late reply! I was busy with something else. 😓

Oops, the variable is now named lsp-diagnostics-provider; glad they didn't make the variable obsolete. Another solution will be add both diagnostic backends. Like:

(setq sideline-backends-right '(sideline-lsp sideline-flycheck sideline-flymake))

Make sure you have all packages installed and requires!

innerout commented 1 year ago

I hope everything is fine. No worries about the late answer! I tried the setq statement you suggested, and it still does not work. Also, lsp-diagnostics-provider is set to :auto. To be honest, I am trying to understand why this is not working.

jcs090218 commented 1 year ago

Wait, you are using use-package. So your configuration should remove the -hook at the end.

 (use-package! sideline
-  :hook (flycheck-mode-hook . sideline-mode)
+  :hook (flycheck-mode . sideline-mode)

And for everything else, flycheck-mode-hook, lsp-mode-hook.

innerout commented 1 year ago

I have the following in my config.

(use-package! sideline
  :hook (flycheck-mode . sideline-mode)
  :init
  (setq sideline-order-left 'down              ; or 'up
        sideline-order-right 'up               ; or 'down
        sideline-format-left "%s   "           ; format for left aligment
        sideline-format-right "   %s"          ; format for right aligment
        sideline-priority 100                  ; overlays' priority
        sideline-display-backend-name t)
  (setq sideline-backends-right '(sideline-lsp sideline-flycheck sideline-flymake)))

(use-package! sideline-lsp
  :init
  (setq sideline-lsp-update-mode 'line))

(use-package! sideline
  :hook (flymake-mode-hook . sideline-mode)
  :init
  (setq sideline-flymake-display-errors-whole-line 'line))

(use-package! lsp-mode :hook (lsp-mode-hook . sideline-mode))
(use-package! lsp-ui :init (setq lsp-ui-sideline-enable nil))  ; disable original sideline
(use-package! sideline-flycheck :hook (flycheck-mode-hook . sideline-flycheck-setup))

I am reposting it in case you spot an error. So the current behavior is the following. If I set the sideline-lsp-update-mode and sideline-flymake-display-errors-whole-line to 'point then I can see the sideline error when I hover over the word that is highlighted. Note that with 'line no errors are displayed in the buffer. However, the behavior I want to have is to see all the diagnostics that are in the text currently displayed by the buffer as shown in the image of the sideline package. In the configuration do you see anything that could prevent this behavior?