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

Misalignment with errors spanning multiple lines #12

Open
aciceri opened this issue Aug 9, 2024 · 9 comments
Open

Misalignment with errors spanning multiple lines #12

aciceri opened this issue Aug 9, 2024 · 9 comments

Comments

@aciceri
Copy link

aciceri commented Aug 9, 2024

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

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

aciceri commented Aug 10, 2024

What do you suggest then?

@jcs090218
Copy link
Member

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

@jcs090218
Copy link
Member

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

aciceri commented Aug 10, 2024

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

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

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

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

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)

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

3 participants