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

feat: Add max-width for messages #199

Open
USER-5 opened this issue Jan 6, 2024 · 3 comments
Open

feat: Add max-width for messages #199

USER-5 opened this issue Jan 6, 2024 · 3 comments
Labels
enhancement New feature or request ui Related to formatting or positioning

Comments

@USER-5
Copy link

USER-5 commented Jan 6, 2024

Particularly when used in combination with java (https://github.com/mfussenegger/nvim-jdtls), a lot of the messages are quite wide - it would be nice to truncate some of these messages so they don't display on top of the code (especially since they appear while typing, not just upon save / load).

@USER-5 USER-5 changed the title feat: Add max-width and deduplication for messages feat: Add max-width for messages Jan 6, 2024
@j-hui j-hui added enhancement New feature or request ui Related to formatting or positioning labels Jan 8, 2024
@j-hui
Copy link
Owner

j-hui commented Jan 8, 2024

For completeness, can you give an example of these messages?

In particular, I'd like to know whether it's the annote or the message field that is too wide.

@j-hui
Copy link
Owner

j-hui commented Jan 8, 2024

In 09f0c91 I introduced a new option, render_message, which you can use to truncate messages as you see fit, e.g.,:

render_message = function(msg, cnt)
  msg = cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
  msg = vim.fn.strcharpart(msg, 0, 16) -- truncate to 16 characters
  return msg
end

Does this suffice? (Admittedly, it does not account for newlines, nor does it do anything about the annote part.)

@USER-5
Copy link
Author

USER-5 commented Jan 8, 2024

It's usually the text on the left that is too long (can include URLs, etc.).

I haven't tried a custom formatter yet - I'm a little hesitant to add in-depth custom config myself...
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ui Related to formatting or positioning
Projects
None yet
Development

No branches or pull requests

2 participants