Skip to content

Missing diagnostic.code #243

@SebasF1349

Description

@SebasF1349

Problem X you are solving:

vim.diagnostic.config allows for diagnostics customization (with, for example, float.format or format.suffix). However, right now is not possible to acomodate the diagnostic.code value as it's not available with the current plugin implementation.

Problems encountered under the status quo:

Right now diagnostic.code is merged into the message (

local function formulate_msg(msg, code)
), allowing less message customization.

Suggested feature Y:

Add the code field into diag_fmt instead of in the message. vim.Diagnostic does have a code key (as it extends vim.Diagnostic.Set)

How to solve X now:

Not possible without manually parsing the code from the message with string manipulation.

How can X be solved after feature Y is implmented:

vim.diagnostic.config({
  float = {
    suffix = function(d)
      return string.format('[%s: %s]', d.source, d.code), '' -- d.code is `nil` now
    end,
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions