@@ -397,7 +397,12 @@ module.public = {
397
397
-- @Param end_column (number) - the end column of the conceal
398
398
-- @Param whole_line (boolean) - if true will highlight the whole line (like in diffs)
399
399
-- @Param mode (string: "replace"/"combine"/"blend") - the highlight mode for the extmark
400
- _set_extmark = function (buf , text , highlight , ns , line_number , end_line , start_column , end_column , whole_line , mode )
400
+ -- @Param pos (string: "overlay"/"eol"/"right_align") - the position to place the extmark in (defaults to "overlay")
401
+ _set_extmark = function (buf , text , highlight , ns , line_number , end_line , start_column , end_column , whole_line , mode , pos )
402
+ if not vim .api .nvim_buf_is_loaded (buf ) then
403
+ return
404
+ end
405
+
401
406
-- If the text type is a string then convert it into something that Neovim's extmark API can understand
402
407
if type (text ) == " string" then
403
408
text = { { text , highlight } }
@@ -408,8 +413,8 @@ module.public = {
408
413
end_col = end_column ,
409
414
hl_group = highlight ,
410
415
end_line = end_line ,
411
- virt_text = text or nil ,
412
- virt_text_pos = " overlay" ,
416
+ virt_text = text ,
417
+ virt_text_pos = pos or " overlay" ,
413
418
hl_mode = mode ,
414
419
hl_eol = whole_line ,
415
420
})
@@ -469,18 +474,21 @@ module.public = {
469
474
local todo_item_counts = module .public .completion_levels .get_todo_item_counts (parent )
470
475
471
476
if todo_item_counts .total ~= 0 then
472
- vim . api . nvim_buf_set_extmark (
477
+ module . public . _set_extmark (
473
478
buf ,
479
+ module .public .completion_levels .convert_query_syntax_to_extmark_syntax (
480
+ query .text ,
481
+ todo_item_counts
482
+ ),
483
+ query .highlight ,
474
484
module .private .completion_level_namespace ,
475
485
parent_range .row_start ,
486
+ nil ,
476
487
parent_range .column_start ,
477
- {
478
- virt_text = module .public .completion_levels .convert_query_syntax_to_extmark_syntax (
479
- query .text ,
480
- todo_item_counts
481
- ),
482
- hl_group = query .highlight ,
483
- }
488
+ nil ,
489
+ nil ,
490
+ nil ,
491
+ " eol"
484
492
)
485
493
end
486
494
end )
@@ -533,18 +541,21 @@ module.public = {
533
541
local todo_item_counts = module .public .completion_levels .get_todo_item_counts (node )
534
542
535
543
if todo_item_counts .total ~= 0 then
536
- vim . api . nvim_buf_set_extmark (
544
+ module . public . _set_extmark (
537
545
buf ,
546
+ module .public .completion_levels .convert_query_syntax_to_extmark_syntax (
547
+ data .text ,
548
+ todo_item_counts
549
+ ),
550
+ data .highlight ,
538
551
module .private .completion_level_namespace ,
539
552
node_range .row_start ,
553
+ nil ,
540
554
node_range .column_start ,
541
- {
542
- virt_text = module .public .completion_levels .convert_query_syntax_to_extmark_syntax (
543
- data .text ,
544
- todo_item_counts
545
- ),
546
- hl_group = data .highlight ,
547
- }
555
+ nil ,
556
+ nil ,
557
+ nil ,
558
+ " eol"
548
559
)
549
560
end
550
561
end )
0 commit comments