Skip to content

Commit 79132a9

Browse files
committed
refactor!: remove multiple_diag_under_cursor option, restores the original behavior of the plugin
1 parent 5ceb573 commit 79132a9

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ require("tiny-inline-diagnostic").setup({
9292
-- Minimum message length before wrapping to a new line
9393
softwrap = 30,
9494

95-
-- Show all diagnostics under the cursor if multiple diagnostics exist on the same line
96-
-- If set to false, only the diagnostics under the cursor will be displayed
97-
multiple_diag_under_cursor = false,
98-
9995
-- Configuration for multiline diagnostics
10096
-- Can either be a boolean or a table with the following options:
10197
-- multilines = {

lua/tiny-inline-diagnostic/diagnostic.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,11 @@ local function filter_diags_at_position(opts, diagnostics, line, col)
4848
return #diags_on_line > 0 and diags_on_line or {}
4949
end
5050

51-
if not opts.options.multiple_diag_under_cursor then
52-
local current_pos_diags = vim.tbl_filter(function(diag)
53-
return diag.lnum == line and col >= diag.col and col <= diag.end_col
54-
end, diagnostics)
55-
return #current_pos_diags > 0 and current_pos_diags or diags_on_line
56-
end
51+
local current_pos_diags = vim.tbl_filter(function(diag)
52+
return diag.lnum == line and col >= diag.col and col <= diag.end_col
53+
end, diagnostics)
5754

58-
return diags_on_line
55+
return #current_pos_diags > 0 and current_pos_diags or diags_on_line
5956
end
6057

6158
---@param opts DiagnosticConfig
@@ -164,7 +161,7 @@ local function apply_virtual_texts(opts, event)
164161
local diagnostic_pos = { lnum, 0 }
165162
local virt_lines, offset, need_to_be_under
166163

167-
if opts.options.multiple_diag_under_cursor and lnum == cursor_line then
164+
if lnum == cursor_line then
168165
virt_lines, offset, need_to_be_under =
169166
virtual_text_forge.from_diagnostics(opts, diags, diagnostic_pos, event.buf)
170167
else

0 commit comments

Comments
 (0)