mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-24 10:47:07 +08:00
style(lsp): format lsp.lua
This commit is contained in:
parent
83a6f0c608
commit
a392dc347b
@ -6,7 +6,7 @@ M.clients = {}
|
||||
|
||||
function M.register(filetype, cmd)
|
||||
M.clients[filetype] = {
|
||||
['cmd'] = cmd
|
||||
['cmd'] = cmd,
|
||||
}
|
||||
end
|
||||
|
||||
@ -32,13 +32,13 @@ function M.hover_callback(success, data)
|
||||
vim.api.nvim_command('call SpaceVim#util#echoWarn("Failed to retrieve hover information")')
|
||||
return
|
||||
end
|
||||
if (type(data.contents) == "table") then
|
||||
if type(data.contents) == 'table' then
|
||||
vim.api.nvim_command('leftabove split __lspdoc__')
|
||||
vim.api.nvim_command('set filetype=markdown.lspdoc')
|
||||
vim.api.nvim_command('setlocal nobuflisted')
|
||||
vim.api.nvim_command('setlocal buftype=nofile')
|
||||
vim.api.nvim_command('setlocal bufhidden=wipe')
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, 0, spliteof(data.contents.value, "\n"))
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, 0, spliteof(data.contents.value, '\n'))
|
||||
elseif type(data.contents) == 'string' and data.contents ~= '' then
|
||||
-- for k, v in pairs(data) do
|
||||
-- print(k .. " - " .. v)
|
||||
@ -50,7 +50,7 @@ function M.hover_callback(success, data)
|
||||
vim.api.nvim_command('setlocal nobuflisted')
|
||||
vim.api.nvim_command('setlocal buftype=nofile')
|
||||
vim.api.nvim_command('setlocal bufhidden=wipe')
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, 0, spliteof(data.contents, "\n"))
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, 0, spliteof(data.contents, '\n'))
|
||||
elseif type(data.contents.language) ~= 'string' and data.contents.language ~= '' then
|
||||
vim.api.nvim_command('leftabove split __lspdoc__')
|
||||
vim.api.nvim_command('set filetype=markdown.lspdoc')
|
||||
@ -58,7 +58,7 @@ function M.hover_callback(success, data)
|
||||
vim.api.nvim_command('setlocal buftype=nofile')
|
||||
vim.api.nvim_command('setlocal bufhidden=wipe')
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, 0, { '```' .. data.contents.language })
|
||||
vim.api.nvim_buf_set_lines(0, 1, -1, 0, spliteof(data.contents, "\n"))
|
||||
vim.api.nvim_buf_set_lines(0, 1, -1, 0, spliteof(data.contents, '\n'))
|
||||
vim.api.nvim_buf_set_lines(0, -1, -1, 0, { '```' })
|
||||
elseif type(data.contents.kind) ~= 'string' and data.contents.kind ~= '' then
|
||||
vim.api.nvim_command('leftabove split __lspdoc__')
|
||||
@ -66,7 +66,7 @@ function M.hover_callback(success, data)
|
||||
vim.api.nvim_command('setlocal nobuflisted')
|
||||
vim.api.nvim_command('setlocal buftype=nofile')
|
||||
vim.api.nvim_command('setlocal bufhidden=wipe')
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, 0, spliteof(data.contents, "\n"))
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, 0, spliteof(data.contents, '\n'))
|
||||
else
|
||||
print('No hover information found')
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user