Skip to content

Highlights not applied to restored editors on activation — refresh command also has no effect #61

@Cordaron

Description

@Cordaron

Hi. Found a bug with editor highlights on startup.

Environment:

  • VS Code version: 1.122.1
  • Better Todo Tree version: 1.1.20
  • OS: Windows 11

Steps to reproduce:

  1. Open VS Code with files that were open in the previous session (restored tabs)
  2. Observe that highlights are not applied in the editor for those files
  3. Run Better Todo Tree: Refresh from the command palette — highlights still not applied
  4. Close and reopen one of those files — highlights now appear correctly

Expected behavior — highlights are applied to all open editors on extension activation, including restored tabs.
Actual behavior — highlights are missing for any file that was restored from the previous session. The tree view correctly shows all TODOs. The issue is only with editor decorations. Manual refresh does not help — only physically closing and reopening the file fixes it.

Suspected cause:
On activation, it appears that the updateDecorations() function is never called for editors that are already open. The extension likely needs to iterate over vscode.window.visibleTextEditors on activation (and possibly on manual refresh) and apply decorations to each editor.

Config:

"better-todo-tree.general.tags": [
        "TODO",
        "FIXME",
        "HACK",
        "REVIEW",
        "NOTE",
        "XXX",
        "BUG",
        "[ ]",
        "[/]",
        "[x]"
    ],
    "better-todo-tree.highlights.customHighlight": {
        "TODO": {
            "icon": "check",
            "background": "#324a32",
            "foreground": "#90cc90",
            "iconColour": "#90cc90"
        },
        "FIXME": {
            "icon": "flame",
            "background": "#4a3232",
            "foreground": "#d98888",
            "iconColour": "#d98888"
        },
        "HACK": {
            "icon": "alert",
            "background": "#4a3a22",
            "foreground": "#d4aa6a",
            "iconColour": "#d4aa6a"
        },
        "REVIEW": {
            "icon": "question",
            "background": "#32324a",
            "foreground": "#9090d4",
            "iconColour": "#9090d4"
        },
        "NOTE": {
            "icon": "info",
            "background": "#223848",
            "foreground": "#6ab0d4",
            "iconColour": "#6ab0d4"
        },
        "XXX": {
            "icon": "eye",
            "background": "#224432",
            "foreground": "#6acc8a",
            "iconColour": "#6acc8a"
        },
        "BUG": {
            "icon": "bug",
            "background": "#382438",
            "foreground": "#b48acc",
            "iconColour": "#b48acc"
        },
        "[ ]": {
            "icon": "circle",
            "foreground": "#7aba7a",
            "iconColour": "#7aba7a"
        },
        "[/]": {
            "icon": "circle-slash",
            "foreground": "#baba6a",
            "iconColour": "#baba6a"
        },
        "[x]": {
            "icon": "checklist",
            "foreground": "#999999",
            "iconColour": "#999999"
        }
    },
    "better-todo-tree.highlights.defaultHighlight": {
        "type": "text-and-comment",
        "gutterIcon": true,
        "opacity": 40
    },
    "better-todo-tree.filtering.excludeGlobs": [
        "**/node_modules/**",
        "**/dist/**"
    ],
    "better-todo-tree.tree.tagsOnly": true,
    "better-todo-tree.tree.buttons.groupByTag": true,
    "better-todo-tree.regex.regexCaseSensitive": false,
    "better-todo-tree.highlights.enabled": true,

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions