aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp/utils_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/plugin/lsp/utils_spec.lua')
-rw-r--r--test/functional/plugin/lsp/utils_spec.lua57
1 files changed, 56 insertions, 1 deletions
diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua
index c1f56f2722..64d58eeffd 100644
--- a/test/functional/plugin/lsp/utils_spec.lua
+++ b/test/functional/plugin/lsp/utils_spec.lua
@@ -83,7 +83,62 @@ describe('vim.lsp.util', function()
end)
end)
- describe('normalize_markdown', function()
+ it('convert_input_to_markdown_lines', function()
+ local r = exec_lua(function()
+ local hover_data = {
+ kind = 'markdown',
+ value = '```lua\nfunction vim.api.nvim_buf_attach(buffer: integer, send_buffer: boolean, opts: vim.api.keyset.buf_attach)\n -> boolean\n```\n\n---\n\n Activates buffer-update events. Example:\n\n\n\n ```lua\n events = {}\n vim.api.nvim_buf_attach(0, false, {\n on_lines = function(...)\n table.insert(events, {...})\n end,\n })\n ```\n\n\n @see `nvim_buf_detach()`\n @see `api-buffer-updates-lua`\n@*param* `buffer` — Buffer handle, or 0 for current buffer\n\n\n\n@*param* `send_buffer` — True if whole buffer.\n Else the first notification will be `nvim_buf_changedtick_event`.\n\n\n@*param* `opts` — Optional parameters.\n\n - on_lines: Lua callback. Args:\n - the string "lines"\n - buffer handle\n - b:changedtick\n@*return* — False if foo;\n\n otherwise True.\n\n@see foo\n@see bar\n\n',
+ }
+ return vim.lsp.util.convert_input_to_markdown_lines(hover_data)
+ end)
+ local expected = {
+ '```lua',
+ 'function vim.api.nvim_buf_attach(buffer: integer, send_buffer: boolean, opts: vim.api.keyset.buf_attach)',
+ ' -> boolean',
+ '```',
+ '',
+ '---',
+ '',
+ ' Activates buffer-update events. Example:',
+ '',
+ '',
+ '',
+ ' ```lua',
+ ' events = {}',
+ ' vim.api.nvim_buf_attach(0, false, {',
+ ' on_lines = function(...)',
+ ' table.insert(events, {...})',
+ ' end,',
+ ' })',
+ ' ```',
+ '',
+ '',
+ ' @see `nvim_buf_detach()`',
+ ' @see `api-buffer-updates-lua`',
+ '',
+ -- For each @param/@return: #30695
+ -- - Separate each by one empty line.
+ -- - Remove all other blank lines.
+ '@*param* `buffer` — Buffer handle, or 0 for current buffer',
+ '',
+ '@*param* `send_buffer` — True if whole buffer.',
+ ' Else the first notification will be `nvim_buf_changedtick_event`.',
+ '',
+ '@*param* `opts` — Optional parameters.',
+ ' - on_lines: Lua callback. Args:',
+ ' - the string "lines"',
+ ' - buffer handle',
+ ' - b:changedtick',
+ '',
+ '@*return* — False if foo;',
+ ' otherwise True.',
+ '@see foo',
+ '@see bar',
+ }
+ eq(expected, r)
+ end)
+
+ describe('_normalize_markdown', function()
it('collapses consecutive blank lines', function()
local result = exec_lua(function()
local lines = {