add some config options

Hey oh The diagnostic virtual text has some options to add the source of each diagnostic as well as a callback to change the diagnostic before it is displayed. I use the latter to filter by new lines so that diagnostics which have multiple lines only display the first one. No such options are exported in the plugin. I added them if you are interested you can have a look. I don't know how to add diffs here so I'll do it the old fashioned way

Line 59:

local prefix = opts.virtual_lines.prefix or "▼"
local use_source = opts.virtual_lines.source or false
local truncate_new_line = opts.virtual_lines.truncate_new_line or false

Line 62:

local source = string.lower(use_source and diagnostic.source or "")

Line 74:

  string.format("%s %s %s", lprefix, source, diag_line),

Line 79:

if truncate_new_line then

That's it. It is now possible to do:

  virtual_text = false,
  virtual_lines = {
    source = true,
    truncate_new_line = true

Thanks for the plugin it's very helpful

Assigned to
2 years ago
1 year, 11 days ago
No labels applied.

~whynothugo 2 years ago

Can you send a patch with the full change?

You can send a patch either using git send-email, or by creating a fork and using the prepare a patchset button on the repository page.

~whynothugo 1 year, 8 months ago

I had made prefix configurable back in January, but with the latest changes there's no prefix any more.

Showing source would still be desirable tho, keeping open.

~acksld 1 year, 11 days ago

Register here or Log in to comment, or comment via email.