Gruntfuggly / todo-tree

Use ripgrep to find TODO tags and display the results in a tree view
Other
1.44k stars 139 forks source link

`hideFromTree` option does not work #704

Closed metablaster closed 1 year ago

metablaster commented 1 year ago

What's the issue

hideFromTree option does not work

How to reproduce

Add the following configuration to your settings

"todo-tree.general.tags": [
    "NOTE",
        // your other tags go here...
],
"todo-tree.highlights.customHighlight": {
    "NOTE": {
        "icon": "info",
        "type": "tag",
        "foreground": "#ffffff",
        "background": "#2ec920", // Custom green
        "iconColour": "#228B22", // ForestGreen
        "opacity": 40,
                // BUG: Not working
        "hideFromTree ": true
    }
}

Make a NOTE: commend somewhere in your sources, ex:

// NOTE: test comment which must not be shown in the tree

Refresh your todo-tree and you'll see that NOTE is not hidden from tree.

Expected behavior

NOTE tags are not shown in the tree

Actual behavior

NOTE tags are shown in the tree even though "hideFromTree ": true is set.

Gruntfuggly commented 1 year ago

With your settings as posted this works as expected for me. If I change hideFromTree to false it appears, setting it to true removes it again.

Do have any other todo tree settings defined?

metablaster commented 1 year ago

I'm glad to hear it works for you, now I'm certain something is wrong with my configuration, yes I do have a lot settings explicitly defined in workspace settings as follows:

    "todo-tree.filtering.includeHiddenFiles": false,
    "todo-tree.filtering.useBuiltInExcludes": "file and search excludes",
    "todo-tree.general.debug": false,
    "todo-tree.general.enableFileWatcher": false,
    "todo-tree.general.revealBehaviour": "start of todo",
    "todo-tree.general.rootFolder": "${workspaceFolder}",
    "todo-tree.general.showActivityBarBadge": false,
    "todo-tree.general.showIconsInsteadOfTagsInStatusBar": true,
    "todo-tree.general.statusBar": "none",
    "todo-tree.general.statusBarClickBehaviour": "reveal",
    "todo-tree.general.tags": [
        "HACK",
        "TODO",
        "NOTE",
        "INFO",
        "BUG",
        "FIX",
        "MSDN",
        "DOCS",
        "CAUTION",
        "ISSUE",
        "cSpell",
        "[ ]",
        "[x]"
    ],
    "todo-tree.general.tagGroups": {
        "NOTE": [
            "NOTE",
            // Important information
            "INFO"
        ],
        "BUG": [
            "BUG",
            // A bug that needs fixing
            "FIX"
        ],
        "MSDN": [
            "MSDN",
            // Citing non Microsoft documentation
            "DOCS"
        ]
    },
    "todo-tree.highlights.customHighlight": {
        // Hard to resolve or it requires huge rework
        "HACK": {
            "icon": "zap",
            "type": "tag",
            "foreground": "#ffffff",
            "background": "#ff0000",
            "opacity": 70,
            "iconColour": "#ff0000"
        },
        // Needs additional work or update
        "TODO": {
            "icon": "tools",
            "type": "tag",
            "foreground": "#000000",
            "background": "#ffffff",
            "iconColour": "#ffffff",
            "opacity": 90
        },
        // Important comment
        "NOTE": {
            "icon": "info",
            "type": "tag",
            "foreground": "#ffffff",
            "background": "#2ec920", // Custom green
            "iconColour": "#228B22", // ForestGreen
            "opacity": 40,
            "hideFromTree ": true
        },
        // Known bug, need to fix
        "BUG": {
            "icon": "bug",
            "type": "tag",
            "foreground": "#ffffff",
            "background": "#ff0000",
            "iconColour": "#ff0000",
            "opacity": 70
        },
        // Citing Microsoft documentation
        "MSDN": {
            "icon": "beaker",
            "type": "tag",
            "foreground": "#fff8dc", // Cornsilk
            "background": "#00bfff", // DeepSkyBlue
            "iconColour": "#00bfff", // DeepSkyBlue
            "opacity": 65
        },
        // Warning to developer
        "CAUTION": {
            "icon": "alert",
            "type": "tag",
            "foreground": "#ffffff",
            "background": "#FDA50F", // Fire
            "iconColour": "#FDA50F", // Fire
            "opacity": 60
        },
        // Citing GitHub issue or a link to the issue
        "ISSUE": {
            "icon": "mark-github",
            "type": "tag",
            "foreground": "#000000",
            "background": "#ffffff",
            "iconColour": "#ffffff",
            "opacity": 90
        },
        // cSpell checker command
        "cSpell": {
            "icon": "info",
            "type": "text",
            "foreground": "#ffffff",
            "background": "#2ec920", // Custom green
            "iconColour": "#2ec920", // Custom green
            "opacity": 40,
            "fontStyle": "italic",
            "hideFromTree ": true
        },
        // Unchecked box
        "[ ]": {
            "icon": "markdown",
            "type": "tag",
            "foreground": "#000000",
            "background": "#ffffff",
            "iconColour": "#ffffff",
            "opacity": 90,
            "hideFromTree ": true
        },
        // Checked box
        "[x]": {
            "icon": "markdown",
            "type": "tag",
            "foreground": "#ffffff",
            "background": "#2ec920", // Custom green
            "iconColour": "#2ec920", // Custom green
            "opacity": 40,
            "hideFromTree ": true
        }
    },
    "todo-tree.highlights.enabled": true,
    "todo-tree.highlights.highlightDelay": 500,
    "todo-tree.highlights.useColourScheme": false,
    "todo-tree.regex.enableMultiLine": false,
    // NOTE: The default regex will be updated to reflect these changes at some point in the future.
    "todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|^\\s*(-|\\d+.))\\s*($TAGS)",
    "todo-tree.regex.regexCaseSensitive": true,
    "todo-tree.tree.autoRefresh": true,
    "todo-tree.tree.buttons.expand": true,
    "todo-tree.tree.buttons.export": true,
    "todo-tree.tree.buttons.filter": true,
    "todo-tree.tree.buttons.groupBySubTag": false,
    "todo-tree.tree.buttons.groupByTag": true,
    "todo-tree.tree.buttons.refresh": true,
    "todo-tree.tree.buttons.reveal": true,
    "todo-tree.tree.buttons.scanMode": true,
    "todo-tree.tree.buttons.viewStyle": true,
    "todo-tree.tree.disableCompactFolders": false,
    "todo-tree.tree.expanded": false,
    "todo-tree.tree.filterCaseSensitive": false,
    "todo-tree.tree.flat": false,
    "todo-tree.tree.groupedBySubTag": false,
    "todo-tree.tree.groupedByTag": false,
    "todo-tree.tree.hideIconsWhenGroupedByTag": false,
    "todo-tree.tree.hideTreeWhenEmpty": false,
    "todo-tree.tree.scanAtStartup": true,
    "todo-tree.tree.scanMode": "workspace",
    "todo-tree.tree.showBadges": true,
    "todo-tree.tree.showCountsInTree": true,
    "todo-tree.tree.showCurrentScanMode": true,
    "todo-tree.tree.sort": true,
    "todo-tree.tree.sortTagsOnlyViewAlphabetically": false,
    "todo-tree.tree.tagsOnly": false,
    "todo-tree.tree.trackFile": true,

thanks you for heads up, I might play with the settings as well...

EDIT:

I have commented out all of my settings except what's in my initial post and I'm still having the issue, here is more information about my environment and extension host output shows some errors:

VSCode:

Version: 1.73.1 (system setup)
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T04:27:29.066Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: No

Todo-Tree:

Todo Tree v0.0.220

Extension host output: (CTRL + SHIFT + P) Developer: Set Log Level... -> Extension host -> Trace Developer: Reload Window

2022-12-11 20:19:44.296 [trace] CommandsConverter#DISPOSE 32
2022-12-11 20:19:44.302 [error] An error occurred when deactivating the subscriptions for extension 'Gruntfuggly.todo-tree':
2022-12-11 20:19:44.303 [error] AggregateError: Encountered errors while disposing of store
    at _ (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10:12263)
    at h._deactivate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:104:13490)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:104:10637
    at Array.map (<anonymous>)
    at h._deactivateAll (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:104:10624)
    at h.terminate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:104:11010)
    at f.terminate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:108:1565)
    at b (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:19113)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:17041
    at h.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:61:145)
    at v.deliver (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:61:2266)
    at g.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:61:1844)
    at r.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:70:16515)
    at o._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:70:21327)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:70:18770
    at h.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:61:145)
    at v.deliver (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:61:2266)
    at g.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:61:1844)
    at g.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:70:13346)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:70:12476
    at Socket.i (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:70:24594)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2022-12-11 20:19:44.305 [trace] [DiagnosticCollection] remove all (extension, owner) streetsidesoftware.code-spell-checker cSpell
2022-12-11 20:19:44.316 [info] Extension host with pid 2664 exiting with code 0
2022-12-11 20:19:45.908 [info] Extension host with pid 5968 started
Gruntfuggly commented 1 year ago

You've got a space in the preference name in the customHighlight (for several of the tags): "hideFromTree ": true .............^

Took me a while to spot it!

metablaster commented 1 year ago

Man, this is unbelievable...

I usually just copy paste similar code and settings and that's why all of them have space in there. Thank you so much for spotting this! it's really hard to spot such mistakes. 👍

Btw. did you notice that I even changed the title of this issue soon after creating it? I copied even that and still didn't notice, but I remember wondering how the heck did the title end up with a blank space lol

Thanks a bunch!

Gruntfuggly commented 1 year ago

lol - it's a very easy thing to miss. Glad you now got it working!