fidget.nvim icon indicating copy to clipboard operation
fidget.nvim copied to clipboard

feat: Add max-width for messages

Open USER-5 opened this issue 1 year ago • 3 comments
trafficstars

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 avatar Jan 06 '24 22:01 USER-5

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 avatar Jan 08 '24 05:01 j-hui

In 09f0c91d23c3e5939f79c80be2e7bc448d3cbc7d 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.)

j-hui avatar Jan 08 '24 05:01 j-hui

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

USER-5 avatar Jan 08 '24 22:01 USER-5