How do I enable diagnostic icons on the signcolumn?

What I want:

What I have:

Currently diagnostic signs like error,
show up as ‘E’, ‘W’ or ‘H’ on the signcolumn
and I have no idea what this is even part of.

Is this native to neovim?
Is it part of Mason-lspconfig?
Rust-analyzer?

I’ve done an attempt to make them appear but to no avail:

~/.config/nvim/plugin/options.lua

local icons = require "shared.icons"
...
local diagnostic_config = {
  signs = {
    active = true,
    values = {
      { name = "DiagnosticSignError", text = icons.diagnostics.Error },
      { name = "DiagnosticSignWarn", text = icons.diagnostics.Warning },
      { name = "DiagnosticSignHint", text = icons.diagnostics.Hint },
      { name = "DiagnosticSignInfo", text = icons.diagnostics.Information },
    },
  },
  virtual_text = true,
  update_in_insert = false,
  underline = true,
  severity_sort = true,
  float = {
    focusable = true,
    style = "minimal",
    border = "rounded",
    source = "always",
    header = "",
    prefix = "",
  },
}
vim.diagnostic.config(diagnostic_config)

Does it compile at all? The first line looks wrong to me

Yes it does compile.
I have some issues with copy pasting, so I wrote that first line manually and incorrectly.
It’s fixed now.

Should be like this

signs = {
	text = {
	    Level = icon
	},
},

This is mine

signs = {
	 text = {
		[vim.diagnostic.severity.ERROR] = utils.get_icon 'error',
		[vim.diagnostic.severity.WARN] = utils.get_icon 'warn',
		[vim.diagnostic.severity.HINT] = utils.get_icon 'hint',
		[vim.diagnostic.severity.INFO] = utils.get_icon 'info',
	},
},
1 Like

I guess I solved it separately as this is mine:

...
signs = {
    active = true,
    text = {
      [vim.diagnostic.severity.ERROR] = icons.diagnostics.Error,
      [vim.diagnostic.severity.WARN]= icons.diagnostics.Warning,
      [vim.diagnostic.severity.HINT] = icons.diagnostics.Hint,
      [vim.diagnostic.severity.INFO] = icons.diagnostics.Information,
    },
  },
...
1 Like