Open taDachs opened 1 year ago
You can use markdown's fenced code block
.
\`\`\`ros
I tried it like this:
function source:resolve(completion_item, callback)
if completion_item.data.msg ~= nil then
completion_item.documentation = {
kind = require("cmp").lsp.MarkupKind.Markdown,
value = "```\n" .. table.concat(completion_item.data.msg.definition, "\n") .. "\n```",
}
end
callback(completion_item)
end
but that doesn't seem to work. Maybe because the highlighting is only available via treesitter? I am not too familiar with the internals of nvim-cmp, so there doesn't seem to be a way to set the filetype for the buffer the documentation is displayed in directly
I have implemented a (hacky) way to set the ft per documentation entry. I opened PR #1490 if you are interested
Hello there, I am currently working on a custom source for ros messages. The text I want to display as the documentation is a custom filetype (currently called "ros") with custom highlighting etc.
How can I set the filetype for the documentation window to a custom filetype?
lsp.MarkupContent
seems to only support markdown and plaintext