[X] I have updated the plugin to the latest version before submitting this issue
[X] I have searched the existing issues of todo-comments.nvim
[X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.10.0
Operating system/version
MacOS 12.7.5
Describe the bug
When navigating a file containing KEYWORDS outside of comments, next/prev todo comments jumps to these even if the buffer has treesitter support and todo-comments is configured with comments_only. This issue happens with Go code which contains context.TODO(), and todo-comments using a pattern that does not require a colon.
I think the problem is that is_comment() in highlight.lua returns true or nil, and the caller in jump.lua explicitly checks for false.
A solution would be for is_comment to return false when the buffer has treesitter support and the match is outside of a comment, or for the caller to test against ~= true instead of == false.
Steps To Reproduce
Configure todo-comments with a pattern that does not require a colon and comments_only set to true.
Edit Go source file with calls to context.TODO().
Navigate through todo comments using next/prev todo comments (i.e ]-t. [-t using LazyVim default bindings).
Expected Behavior
next/prev todo comments should not jump to context.TODO() (or any of the KEYWORDS) outside comments.
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.0
Operating system/version
MacOS 12.7.5
Describe the bug
When navigating a file containing KEYWORDS outside of comments, next/prev todo comments jumps to these even if the buffer has treesitter support and todo-comments is configured with comments_only. This issue happens with Go code which contains context.TODO(), and todo-comments using a pattern that does not require a colon.
I think the problem is that is_comment() in highlight.lua returns true or nil, and the caller in jump.lua explicitly checks for false. A solution would be for is_comment to return false when the buffer has treesitter support and the match is outside of a comment, or for the caller to test against ~= true instead of == false.
Steps To Reproduce
Expected Behavior
next/prev todo comments should not jump to context.TODO() (or any of the KEYWORDS) outside comments.
Repro