Todo-tree: Bug: "TypeError: Cannot read property 'trim' of undefined" at Version 0.0.164

Created on 21 Jan 2020  路  14Comments  路  Source: Gruntfuggly/todo-tree

Hi there

With the latest avialable Release 0.0.164 this extension not working anymore as expected.
TODOS are no longer displayed:
image
This happens are inital on Open the File and also, when we tryed to Refresh.

VSCode-Version: 1.41.1 (system setup)
OS: Win10, 10.0.0.17763

Errorlog from Extensionhost:

[2020-01-21 10:34:57.877] [exthost] [error] TypeError: Cannot read property 'trim' of undefined
    at createTodoNode (c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\tree.js:166:32)
    at TreeNodeProvider.add (c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\tree.js:609:24)
    at c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\extension.js:105:26
    at Array.map (<anonymous>)
    at addResultsToTree (c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\extension.js:101:23)
    at refreshFile (c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\extension.js:599:9)
    at c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\extension.js:334:13
    at Array.map (<anonymous>)
    at refreshOpenFiles (c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\extension.js:332:38)
    at rebuild (c:\Users\{username}\.vscode\extensions\gruntfuggly.todo-tree-0.0.164\extension.js:464:9)
    at v._executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:538:925)
    at v.$executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:539:295)
    at p._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:663:275)
    at p._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:662:971)
    at p._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:661:639)
    at p._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:660:468)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:658:691
    at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:893)
    at _.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:189:274)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:820:285
    at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:893)
    at _.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:189:274)
    at t.PersistentProtocol._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:193:629)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:190:824
    at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:893)
    at p.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:186:737)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:186:89
    at Socket.t (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:195:68)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17) todo-tree.refresh

What's the Problem are now?

  • Is this issue config related? Then please tell us, what must changed in this (before has our config worked an was unchanged until now)
  • Or its a Bug? Then please fix it.

Thank You verry much.

bug fixed

Most helpful comment

@Gruntfuggly if use this regex in 0.165 version , no bug

"todo-tree.regex.regex": "^(/[a-zA-Z0-9_.\\\\-芦禄/(/)]{1,}|# TODO|# FIXME)",

but if use default regex setting, bug exist

All 14 comments

Our Config (Example):

    "todo-tree.regex.regex": "^(/[a-zA-Z0-9_.\\\\-芦禄/(/)]{1,}|# TODO|# FIXME)",
    "todo-tree.regex.regexCaseSensitive": false,
    "todo-tree.tree.filterCaseSensitive": false,
    "todo-tree.tree.showTagsFromOpenFilesOnly": true,
    "todo-tree.tree.autoRefresh": true,
    "todo-tree.tree.showBadges": true,
    "todo-tree.tree.showCountsInTree": true,
    "todo-tree.highlights.defaultHighlight": 
    {
        "foreground": "#088A08",
        "type": "none"
    },
    "todo-tree.highlights.customHighlight": 
    {
        "(/headerreport|/headerpage|/headercarry|/totalcarry|/totalreport|/body|/totalpage|/totalreport)": 
        {
            "foreground": "#FFFF00"
        },
        "GetInfoScript": 
        {
            "foreground": "#A5DF00"
        },
        "LIB": 
        {
            "foreground": "#FF00FF"
        },
        "(TODO|FIXME)": 
        {
            "foreground": "#FF0000"
        } 
    },

It looks like its failed to extract the tag. Please can you give me an example of something it should match so I can reproduce it.

It's OK - I've reproduced it.

I've just uploaded a fixed version - it was because your regex does not use the $TAGS substitution. Hopefully it should now work as before.

Version 0.165,

TypeError: Cannot read property 'trim' of undefined
    at createTodoNode (/Users/qweqwe/.vscode/extensions/gruntfuggly.todo-tree-0.0.165/tree.js:166)
    at TreeNodeProvider.add (/Users/qweqwe/.vscode/extensions/gruntfuggly.todo-tree-0.0.165/tree.js:609)
    at /Users/u17505688/.vscode/extensions/gruntfuggly.todo-tree-0.0.165/extension.js:105
    at Array.map (<anonymous>)
    at addResultsToTree (/Users/qweqwe/.vscode/extensions/gruntfuggly.todo-tree-0.0.165/extension.js:101)
    at /Users/u17505688/.vscode/extensions/gruntfuggly.todo-tree-0.0.165/extension.js:371
    at onComplete (/Users/qweqwe/.vscode/extensions/gruntfuggly.todo-tree-0.0.165/extension.js:207)
    at /Users/qweqwe/.vscode/extensions/gruntfuggly.todo-tree-0.0.165/extension.js:237

vscode setting

 "todo-tree.filtering.excludeGlobs": [
    "**/build/**",
    "**/jquery*/**",
    "**/node_modules/**",
    "**/vendor/**",
    "**/bower_components/**",
    "**/dist/**"
  ],
  "todo-tree.general.tags": [
    "TODO",
    "FIXME"
  ],

Now it works again. Very Cool.
Thank you verry much, for your fast bugfix.

I'm confused - your debug output (from 0.0.165) shows it's failing? Did it actually fail?

@Gruntfuggly if use this regex in 0.165 version , no bug

"todo-tree.regex.regex": "^(/[a-zA-Z0-9_.\\\\-芦禄/(/)]{1,}|# TODO|# FIXME)",

but if use default regex setting, bug exist

Ah yes - there's another edge case. I'll add another fix for the next release.

Hi @Gruntfuggly
after updating to 0.165 I get the trim error with this regex

"todo-tree.regex.regex": "(^\\s*- \\[(\\s)\\])\\s*($TAGS)?.*",

Could you add the rest of your todo-tree config - it works OK when I try it? I think I already have a fix for it, but I'd like to understand the cause first.

I am getting the error with 0.165. My regex is: ((//|#|