todo-comments.nvim icon indicating copy to clipboard operation
todo-comments.nvim copied to clipboard

[Feature Request] Multi Line Comment Highlight

Open B4rc1 opened this issue 4 years ago • 9 comments

Hey, awesome plugin, I really like it, but I find myself writing a lot of multi line comments. Currently, they are highlighted like this: image This really bothers me and It would be cool to extend the highlighting of comments to the next line, if the Indentation of the first character aligns/matches.

B4rc1 avatar Jun 16 '21 18:06 B4rc1

I was about to request the same feature, any update? Is it possible?

Pasqat avatar Jun 24 '21 09:06 Pasqat

I came to suggest the same feature, looks like I'm in good company.

foundObjects avatar Nov 12 '21 10:11 foundObjects

I think this would be a nice feature as well.

skaphi avatar Feb 17 '22 10:02 skaphi

Any updates on this?

wizard-28 avatar Mar 09 '22 10:03 wizard-28

@wizard-28 just wait or implement it yourself. It’s considered bad form to bump a feature-request like that.

tim-hilt avatar Mar 09 '22 11:03 tim-hilt

This can probably be done using Treesitter right? Might take a stab at a PR for this some time this weekend or next week or something.

mrjones2014 avatar Mar 09 '22 15:03 mrjones2014

Very keen for this! It's the only feedback i'd have for this great plugin. I'm happy to help get a PR in if someone has already had a go, other wise i'll try to have a go in the coming weeks if I find time

frdwhite24 avatar Apr 22 '22 17:04 frdwhite24

Same question, now I disabled non-keyword highlight to make multi-line comments look suitable:

image

My config:

require("todo-comments").setup {
  signs = true,
  highlight = {
    before = "", -- "fg" or "bg" or empty
    keyword = "bg", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
    after = "", -- "fg" or "bg" or empty
    comments_only = true, -- uses treesitter to match keywords in comments only
    max_line_len = 400, -- ignore lines longer than this
    exclude = {}, -- list of file types to exclude highlighting
    pattern = [[.*<(KEYWORDS)[^:]*:]],
  },
}

fioncat avatar Aug 31 '22 03:08 fioncat

I actually have found this to be a good thing because it forces me to write concisely a 'title' and then all following lines are my extra context. Just my two cents.

Integralist avatar Sep 29 '22 12:09 Integralist

I just pushed an update that implements this

folke avatar Oct 27 '22 12:10 folke

Cool addition, works great! The only thing I find a bit weird is how each line adds an entry to the sign column, as opposed to just the line containing the relevant KEYWORD.

daephx avatar Oct 27 '22 13:10 daephx

Works wonderfully, thank you!

B4rc1 avatar Oct 27 '22 13:10 B4rc1

although I have to agree with @daephx, the signcolumn entry for each line of the comment looks a bit odd

B4rc1 avatar Oct 27 '22 13:10 B4rc1

Right, forgot about that. Fixed!

folke avatar Oct 27 '22 14:10 folke