zed icon indicating copy to clipboard operation
zed copied to clipboard

Highlighting of special code comment types like TODO, INFO, etc.

Open adiepenbrock opened this issue 1 year ago • 16 comments

Check for existing issues

  • [X] Completed

Describe the feature

One feature that I find really useful in other editors, e.g., Neovim with the plugin "folke/todo-comments," is the ability to highlight specific types of comments like // TODO // INFO and others. This feature enhances productivity by making it easier to locate and manage important comments within the codebase when scrolling / jumping through the code.

Because there may be users who don't want this kind of highlights in the code, it should be configurable by the user (activate / deactivate, configure highlighting color or deriving it from the used theme, etc.)

There is already a feature request (#4808) to introduce a separate tree-structure overview of these comments. However, I think this should also be available in the code itself.

If applicable, add mockups / screenshots to help present your vision of the feature

image

adiepenbrock avatar May 16 '24 08:05 adiepenbrock

I'm considering to work on this. Some instructions on how to do it? Colours for example. And is it still needed?

francesco-gaglione avatar Jul 20 '24 17:07 francesco-gaglione

I don't know about the color requirements, but any implementation would probably be a good start. I use this every day in other editors and find it very useful :)

diogox avatar Aug 20 '24 20:08 diogox

I readed somewhere that this should be done zed extensions and not in the core codebase. It is still true or we want to consider to implement it in the core?

francesco-gaglione avatar Aug 20 '24 21:08 francesco-gaglione

@francesco-gaglione did you wind up taking a stab at this?

kofron avatar Sep 09 '24 17:09 kofron

@kofron I need first the confirmation from mainteiners to do this into zed core and not in the plugins

francesco-gaglione avatar Sep 10 '24 09:09 francesco-gaglione

There is this open issue: https://github.com/zed-industries/extensions/issues/523 where the direction was to implement it as an extension.

everdrone avatar Sep 17 '24 12:09 everdrone

My hope is that a straightforward comment tag system could just be integrated into zed itself.

aretrace avatar Nov 01 '24 23:11 aretrace

@francesco-gaglione you can take a stab at implementing this in the core. Why I believe this is useful:

  • we will have a working highlight implementation
  • it will expose what APIs are necessary; if they are all available to the plugins, it will be trivial to port over
  • otherwise, first things to do would be to expose those APIs to plugins

So the work is not wasted anyway.

berkus avatar Nov 04 '24 10:11 berkus

@berkus it is a lot of time I don't contribute here... but it is very usefull so I'll take a look.... some hint on where to start?

francesco-gaglione avatar Nov 04 '24 11:11 francesco-gaglione

No idea, i am not super familiar with zed's internals. I would look through syntax highlighting and editing plumbing - it's probably there at the intersection of those parts.

berkus avatar Nov 04 '24 11:11 berkus

I also use NOTE and this package https://github.com/folke/todo-comments.nvim includes

keywords = {
    FIX = {
      icon = " ", -- icon used for the sign, and in search results
      color = "error", -- can be a hex color, or a named color (see below)
      alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
      -- signs = false, -- configure signs for some keywords individually
    },
    TODO = { icon = " ", color = "info" },
    HACK = { icon = " ", color = "warning" },
    WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
    PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
    NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
    TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
}

phistep avatar Nov 07 '24 14:11 phistep

@kofron I need first the confirmation from mainteiners to do this into zed core and not in the plugins

@kofron @berkus see https://github.com/zed-industries/zed/pull/9082#issuecomment-1997957426

tl;dr: someone tried to merge a working implementation but got denied, devs want this as an extension and not in core

iairu avatar Nov 21 '24 21:11 iairu

Not sure if this would need another issue, but it would also be nice if Zed would have a panel for listing all TODO comments in a project to find them easier.

Trikzon avatar Dec 18 '24 01:12 Trikzon

Not sure if this would need another issue, but it would also be nice if Zed would have a panel for listing all TODO comments in a project to find them easier.

This seems to be related https://github.com/zed-industries/zed/issues/10546 but it's all unified under https://github.com/zed-industries/extensions/issues/523

berkus avatar Jan 02 '25 21:01 berkus