Todo-tree: "Path must be a string. Received undefined"

Created on 28 Nov 2018  路  16Comments  路  Source: Gruntfuggly/todo-tree

TodoTree does not load anymore. In the list I see
filename.php(PATH)
but when I click, no TODOs are loaded.
Instead in the bottom right I get the message/warning:
"Path must be a string. Received undefined"

What could that be?

bug fixed

All 16 comments

Can you open the console (Help -> Toggle Developer Tools) and see where the error is coming from? It should show a stack trace.

Also, what settings are you using for 'group', 'flat', etc.?

Here the full error:
Error: Path must be a string. Received undefined at assertPath (path.js:28:11) at Object.join (path.js:501:7) at Object.getIcon (C:\Users\USER\.vscode\extensions\gruntfuggly.todo-tree-0.0.106\icons.js:50:37) at TreeNodeProvider.getTreeItem (C:\Users\USER\.vscode\extensions\gruntfuggly.todo-tree-0.0.106\tree.js:321:43) at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:444:1003 at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:114:65 at new Promise (<anonymous>) at Object.t.asThenable (c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:114:33) at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:444:959 at Array.map (<anonymous>) at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:444:934 at <anonymous>
I can't change anything and it does not matter what I click, I get the error.

That error suggests that a custom icon colour can't be found. What are your customHighlight and defaultHighlight set to?

Or the other possibility is that the extension can't access it's own storage?

If there is nothing obvious, I have a small fix you could try.

I am just about to upload a change to provide the simple view from your other issue - I've added a small fix which may help with this one too.

Thank you very much! I am not sure why this here happened. It occured just today, yesterday everything was fine. Maybe I did something wrong, I am not sure.

Some snippets:
"todo-tree.customHighlight": { "TODO": { "foreground": "white", "iconColour": "#45B642", "color": "black", "backgroundColor": "#45B642", "overviewRulerColor": "#ffab00", "cursor": "pointer", "border": "1px solid #eee", "borderRadius": "2px", "icon": "check", },

And
"todo-tree.tags": [ "TODO",

When I remove the whole "todo-tree.tags", the error does not occur. I hope it helps.
I'll have to go to work so won't be able to check in here the next hours but hopefully this information was helpful (maybe it's also my fault, I don't hope so :D)

Hmm - it looks like your settings might be broken if you've copied them directly? Could you post the whole file - or I can send my email address if you'd rather not post them publicly.

Thank you, it would be really cool if we could get this fixed. I had no problems before and did not really change anything so no idea what happened :/

Following did I find out.
When I use the above snippet, I get "path must be a string or Buffer".
When I remove _"icon": "check",_ I get "Path must be a string. Received undefined"
and when I remove _"icon": "check",_ and _"iconColour": "#45B642",_ it works but everything has the same color in the list.

Btw the update is exactly what I wanted so a big thanks for this! :)
Even tho it does not work fully for me yet, but somehow I'll figure out what's happening :D

Also now since the update I don't get only the error I posted above but a new one (with "Buffer"):
path must be a string or Buffer at fs.mkdirSync (fs.js:885:18) at Object.fs.mkdirSync (ELECTRON_ASAR.js:702:16) at Object.getIcon (C:\Users\USER\.vscode\extensions\gruntfuggly.todo-tree-0.0.107\icons.js:30:16) at TreeNodeProvider.getTreeItem (C:\Users\USER\.vscode\extensions\gruntfuggly.todo-tree-0.0.107\tree.js:339:47) at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:444:1003 at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:114:65 at new Promise (<anonymous>) at Object.t.asThenable (c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:114:33) at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:444:959 at Array.map (<anonymous>) at c:\Users\USER\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:444:934 at <anonymous>

UPDATE: I found out that somehow it does not longer support HTML color code. When I change iconColour to "red" or "green", it works well. But color codes are not accepted and the errors occur. Also when I use like "magenta" it does not work.

It should work with 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan' or 'grey' as well as hex rgb values such as "#ba000d".

Because it creates custom icons and stores them I think that the problem is due to accessing the storage folder. The new error seems to indicate that it can't create the folder.

Would you be happy to try a bit remote debugging for me as I can't reproduce it?

If so, can you open
.vscode/extensions/gruntfuggly.todo-tree-0.0.107/icons.js and

at line 16 add the following:

    console.log( "storage path:" + context.storagePath );
    return { dark: darkIconPath, light: lightIconPath };

You will lose custom icons, but it should allow the extension to work again. Can you let me know what it says for the value of 'storage path' in the debug console?

I get: "storage path:undefined"
Well the plugin works with how I wrote above but all icons are the same and so are the colors. How could this storage problem get fixed by myself probably? Or is this not possible?

I've asked on the vscode-extension-dev slack channel to see if anybody knows why it might be undefined.

Is your workspace on a networked drive on something like that? Is there anything 'different' about it?

One way you can fix it for yourself is to replace all the instances of storagePath with extensionPath in that file. There should be 7 instances.

That will then put the custom icons in the extension folder itself, which is a bit messy, but should work for you.

Omg thank you for whoever helped with this. 馃帀 With what you wrote it works fine now!

I really have no idea what happened here. It only occured since yesterday, I never had problems with it before. I am also not sure what exactly could have caused it because I did not change anything and there was also no update of the plugin.

I use it on a regular computer, so nothing different or so 馃槃

I haven't had an answer yet - that fix was a hack from how the extension used to work! 馃榾

If I get an answer, I'll do a proper update. In the meantime, I put the fix in as a stopgap in the next release, otherwise you will have do it yourself every update. It's not very nice, but if it makes it work...

Great hack!

I think I won't have a problem to change it manually. I'm happy for now that we got around it. And I don't care if there are some more files in the folder. Thanks again and also thanks for implementing my idea, it really makes it better! Together with TODO Highlight it's just way more beautiful to work 馃榾

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bitjson picture bitjson  路  7Comments

josbalcaen picture josbalcaen  路  5Comments

bitjson picture bitjson  路  8Comments

emanuelenardi picture emanuelenardi  路  3Comments

fheinicke picture fheinicke  路  6Comments