Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions lua/lspsaga/diagnostic/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,24 +253,26 @@ local FORWARD, BACKWARD = 1, -1

function diag:goto_pos(pos, opts)
local is_forward = pos == FORWARD
local entry = (is_forward and vim.diagnostic.get_next or vim.diagnostic.get_prev)(opts)
local entry = vim.diagnostic.jump(vim.tbl_extend('keep', {
count = is_forward and 1 or -1,
on_jump = function()
vim.diagnostic.open_float({
border = config.ui.border,
format = function(d)
if not vim.bo[api.nvim_get_current_buf()].filetype == 'rust' then
return d.message
end
return d.message:find('\\n`$') and d.message:gsub('\\n`$', '`') or d.message
end,
header = '',
prefix = { '• ', 'Title' },
})
end,
}, opts or {}))

if not entry then
return
end
(is_forward and vim.diagnostic.goto_next or vim.diagnostic.goto_prev)(vim.tbl_extend('keep', {
float = {
border = config.ui.border,
format = function(diagnostic)
if not vim.bo[api.nvim_get_current_buf()].filetype == 'rust' then
return diagnostic.message
end
return diagnostic.message:find('\n`$') and diagnostic.message:gsub('\n`$', '`')
or diagnostic.message
end,
header = '',
prefix = { '• ', 'Title' },
},
}, opts or {}))
util.valid_markdown_parser()
require('lspsaga.beacon').jump_beacon({ entry.lnum, entry.col }, #api.nvim_get_current_line())
vim.schedule(function()
Expand Down
4 changes: 1 addition & 3 deletions lua/lspsaga/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ function M.gen_truncate_line(width)
end

function M.get_max_content_length(contents)
vim.validate({
contents = { contents, 't' },
})
vim.validate('contents', contents, 'table')
local cells = {}
for _, v in pairs(contents) do
if v:find('\n.') then
Expand Down
18 changes: 5 additions & 13 deletions lua/lspsaga/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ local ui = require('lspsaga').config.ui
local win = {}

local function make_floating_popup_options(opts)
vim.validate({
opts = { opts, 't', true },
})
vim.validate('opts', opts, 'table', true)
opts = opts or {}
vim.validate({
['opts.offset_x'] = { opts.offset_x, 'n', true },
['opts.offset_y'] = { opts.offset_y, 'n', true },
})
vim.validate('opts.offset_x', opts.offset_x, 'number', true)
vim.validate('opts.offset_y', opts.offset_y, 'number', true)

local anchor = ''
local row, col
Expand Down Expand Up @@ -124,9 +120,7 @@ end

--float window only
function obj:winsetconf(config)
validate({
config = { config, 't' },
})
validate('config', config, 'table')
api.nvim_win_set_config(self.winid, config)
return self
end
Expand All @@ -144,9 +138,7 @@ function obj:setheight(height)
end

function win:new_float(float_opt, enter, force)
vim.validate({
float_opt = { float_opt, 't', true },
})
vim.validate('float_opt', float_opt, 'table', true)
enter = enter or false

self.bufnr = float_opt.bufnr or api.nvim_create_buf(false, false)
Expand Down
Loading