How to have syntax highlighting in LSP's floating error/warning/info window?

LSP’s floating window (not including the signature help or hover windows) used
for error,warning and info has a single color for the whole text, and you can
customize it using highlighting groups.

The error message contains all sorts of useful information including types, and
I found out with coc.nvim that if I set the color of the text of the error
message to the syntax highlight of that specific programming language it is much
more useful (depending on the error and language used).

coc.nvim has this option, It should be this.

Does the built-in LSP have something similar?

I tried looking at the help and found:

  • vim.lsp.diagnostic.goto_next() takes opts, opts.popup_opts are forwarded to:
  • vim.lsp.diagnostic.show_line_diagnostics() whose opts include the opts
    for:
  • vim.lsp.util.open_floating_preview() that has syntax as its second
    argument which is exactly what I want to set. However they are not part of
    the opts argument, they are completely separate.
open_floating_preview({contents}, {syntax}, {opts})
{syntax}    string of syntax to set for opened buffer
{opts}      dictionary with optional fields

Does this mean it is impossible? Can I customize my config to make it possible?
Should I run back to coc.nvim? :cry:

Any suggestions are greatly appreciated!
Thanks!

I do not know if this topic is still active.
But if anybody needs an example of how to do it:

vim.keymap.set('n','gl',function ()
    local bufnr,_=vim.diagnostic.open_float()
    vim.api.nvim_buf_set_option(bufnr,'filetype',vim.o.filetype)
    end)