emacs-sideline / sideline-flymake

Show flymake errors with sideline
GNU General Public License v3.0
29 stars 9 forks source link

Misalignment with errors spanning multiple lines #12

Open aciceri opened 3 months ago

aciceri commented 3 months ago

@jcs090218 I believe that this doesn't work when the flymake error takes multiple lines. Consider that I'm using eglot with the haskell-language-server-wrapper LSP server.

In particular looking at the sideline-flymake--show-errors it seems that the candidates are always only one i.e. a string potentially containing multiple lines. And this implies that sideline shows things horizontally misaligned.

image

Changing the last line of the function to (funcall callback (split-string text "\n")) seems to improve a bit the situation but the order is now wrong:

image

Also notice that probably it would make sense removing all the whitespaces a the beginning of each line.

PS: this is my configuration

(use-package sideline
  :delight
  :hook (flymake-mode . sideline-mode)
  :custom
  (sideline-flymake-display-mode 'line)
  (sideline-backends-right '(sideline-flymake))
  (sideline-flymake-max-lines 5)
)

Haven't tried with -Q because I don't think this is due to other packages.

jcs090218 commented 3 months ago

I assumed this is the default behaviour from sideline.

Sideline doesn't take multiple lines rendering into account since there is no space calculation on the newline (inside the overlay). 🤔

aciceri commented 3 months ago

What do you suggest then?

jcs090218 commented 3 months ago

I can add offset to every line except the first line so they at least align along the overlay starting point. 🤔 WDYT?

jcs090218 commented 3 months ago

I don't think there is a good solution for rendering multiple lines on the sideline. I guess the best solution is the set sideline-flymake-max-lines to 1.

aciceri commented 3 months ago

Keeping everything aligned on the right would be an acceptable solution IMO, it's exactly what helix does. Anyway I just realized that sideline-eglot is a thing, what is the intersection with this sideline-flymake? Doesn't eglot relay LSP errors/warnings/etc to flymake? How does sideline-eglot behave with errors spanning multiple lines?

jcs090218 commented 3 months ago

Keeping everything aligned on the right would be an acceptable solution IMO, it's exactly what helix does.

Thanks for the suggestion! I'll have to think about this. 🤔

Doesn't eglot relay LSP errors/warnings/etc to flymake? How does sideline-eglot behave with errors spanning multiple lines?

Yes. You will need sideline-eglot.

Jake-Moss commented 1 month ago

I can add offset to every line except the first line so they at least align along the overlay starting point. 🤔 WDYT?

Thanks for your work on this. Is this still an option? I'm currently using the Metals lsp server for Scala and it just won't respect my configuration options to not use multi-line outputs. It would be nice if there was as fall back option to display multi-line outputs. I've currently monkey patched it to concat into a single line but I'm not experienced enough with overlays to provide a proper fix

jcs090218 commented 1 month ago

No, sorry. As I've explained above, there isn't an ideal solution for it, but I might implement the suggested solution (align to the right). However, I've been very busy recently, so it's probably not going to be implemented anytime soon. PRs are always welcome, though!

Jake-Moss commented 1 month ago

Thanks for the very quick reply.

I might implement the suggested solution (align to the right).

That would work just as well, I'm really only concerned by the jump from right aligned to left aligned. I could ofc configure flymake to be a left backend instead.

However, I've been very busy recently, so it's probably not going to be implemented anytime soon. PRs are always welcome, though!

No worries at all, I took a rough crack at it tonight but didn't get anywhere. I'll have to do some more reading before I go again. I wouldn't hold your breath for a PR from me, though I might put on up eventually (after university exams)