Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sideline not showing warnings-errors only fixes #2

Open
innerout opened this issue Jan 31, 2023 · 8 comments
Open

sideline not showing warnings-errors only fixes #2

innerout opened this issue Jan 31, 2023 · 8 comments

Comments

@innerout
Copy link

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
Copy link
Member

jcs090218 commented Feb 1, 2023

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

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

@innerout
Copy link
Author

innerout commented Feb 1, 2023

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

@jcs090218
Copy link
Member

jcs090218 commented Feb 2, 2023

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

@innerout
Copy link
Author

innerout commented Feb 6, 2023

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

jcs090218 commented Mar 2, 2023

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
Copy link
Author

innerout commented Mar 3, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants