@@ -86,6 +86,38 @@ T["at_position"]["matches whole line when diagnostic has no column info under de
8686 MiniTest .expect .equality (result [1 ].lnum , 5 )
8787end
8888
89+ T [" at_position" ][" default mode keeps line fallback when mixed whole-line and column-specific diagnostics" ] = function ()
90+ local diagnostics = {
91+ H .make_diagnostic ({ lnum = 5 , col = 0 , end_col = 0 }),
92+ H .make_diagnostic ({ lnum = 5 , col = 10 , end_col = 20 }),
93+ }
94+
95+ local result = filter .at_position ({ options = {} }, diagnostics , 5 , 5 )
96+ MiniTest .expect .equality (# result , 2 )
97+ end
98+
99+ T [" at_position" ][" default mode returns only column-specific diagnostic when cursor is on it" ] = function ()
100+ local diagnostics = {
101+ H .make_diagnostic ({ lnum = 5 , col = 0 , end_col = 0 }),
102+ H .make_diagnostic ({ lnum = 5 , col = 10 , end_col = 20 }),
103+ }
104+
105+ local result = filter .at_position ({ options = {} }, diagnostics , 5 , 15 )
106+ MiniTest .expect .equality (# result , 1 )
107+ MiniTest .expect .equality (result [1 ].col , 10 )
108+ end
109+
110+ T [" at_position" ][" show_diags_only_under_cursor merges whole-line and under-cursor diagnostics" ] = function ()
111+ local diagnostics = {
112+ H .make_diagnostic ({ lnum = 5 , col = 0 , end_col = 0 }),
113+ H .make_diagnostic ({ lnum = 5 , col = 10 , end_col = 20 }),
114+ }
115+
116+ local result =
117+ filter .at_position ({ options = { show_diags_only_under_cursor = true } }, diagnostics , 5 , 15 )
118+ MiniTest .expect .equality (# result , 2 )
119+ end
120+
89121T [" under_cursor" ] = MiniTest .new_set ()
90122
91123T [" under_cursor" ][" returns empty for invalid buffer" ] = function ()
0 commit comments