nvim-cmp icon indicating copy to clipboard operation
nvim-cmp copied to clipboard

Add special highlights for markdown docs (underline/strike/bold etc)

Open SrWither opened this issue 2 years ago • 6 comments

when the signature help appears, the colors of the first line are not visible image

in theory it should look like this: image

SrWither avatar Feb 06 '22 22:02 SrWither

It's not only the first line. colors nocolors

To me it seems the signature help is rendered as plain Markdown.

matze avatar Feb 09 '22 08:02 matze

I think it is not the bug of this plugin.

And also I don't think nvim-cmp's bug because nvim-cmp uses vim.lsp.util.stylize_markdown as render.

hrsh7th avatar Feb 09 '22 08:02 hrsh7th

So, it may be the LSP server sending different docstrings depending on completion or not?

matze avatar Feb 09 '22 08:02 matze

Sorry. It's maybe an improvements point at the nvim-cmp side, I think.

But it's difficult. I can't think of a solution for it at the moment. So take a long time to improve this.

hrsh7th avatar Feb 13 '22 10:02 hrsh7th

I'm trying to add <cmp-annotate>...</ cmp-annotate> to a native lsp syntax rule. However, I cannot manage nested syn-region rules at the moment. If someone has a solution. I want help.

The following code is not work correctly...

    --  lua/view/docs_view.lua
    ...
    vim.api.nvim_buf_call(self.window:get_buffer(), function()
      vim.cmd([[syntax clear]])
    end)
    vim.lsp.util.stylize_markdown(self.window:get_buffer(), documents, {
      max_width = maxwidth,
      max_height = documentation.maxheight,
    })
    vim.api.nvim_buf_call(self.window:get_buffer(), function()
      vim.cmd(([[syntax region %s matchgroup=Conceal start=+<cmp-annotate>+ end=+</cmp-annotate>+ contained containedin=ALL concealends keepend oneline]]):format('CmpMarkdownAnnotate'))
    end)
    ...

hrsh7th avatar Feb 13 '22 11:02 hrsh7th

should MDN Reference display as a link here? image

nshen avatar Jun 09 '22 14:06 nshen