Todo-tree: Constant path errors in Windows version path must be of type string

Created on 18 Feb 2019  路  10Comments  路  Source: Gruntfuggly/todo-tree

Hi,

I just installed a fresh copy of vscode yesterday and reinstalled my extensions. I did a system install, no user install.
Todo Tree does not work as I constantly get "The path argument must be of type string. Received type undefined".

My settings are nothing special at all
"todo-tree.customHighlight": {
"TODO": {
"type": "text",
"background": "#80dfff",
"foreground": "#000",
"rulerColour": "#80dfff"
},
"FIXME": {
"type": "text",
"background": "#ff8553",
"foreground": "#000",
"rulerColour": "#ff8553"
}
},
"todo-tree.statusBar": "total"

Can you please help on that? Thanks!

EDIT It seems to have something to do with the icons generation in the tree view as this error always occurs when refreshing. And there is only the file shown in the tree but no line with an icon or reference to the actual markup
Please help as this is a great addon otherwise

bug fixed

All 10 comments

Could you have a look in the console (Help->Toggle Developer Tools) and see if there is a call stack with the error?

If I have no icons in the settings set I get the following error
notificationsAlerts.ts:38 Error: The "path" argument must be of type string. Received type undefined at assertPath (path.js:39:11) at Object.join (path.js:434:7) at Object.getIcon (C:\Users\XXX\.vscode\extensions\gruntfuggly.todo-tree-0.0.118\icons.js:48:37) at TreeNodeProvider.getTreeItem (C:\Users\XXX\.vscode\extensions\gruntfuggly.todo-tree-0.0.118\tree.js:386:43) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:469:761 at t.asPromise (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:50:385) at new Promise (<anonymous>) at Object.t.asPromise (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:50:353) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:469:718 at Array.map (<anonymous>) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:469:693

And if I set an icon with like "icon": "alert" you get the following error
Error: The "path" argument must be one of type string, Buffer, or URL. Received type undefined at fs.mkdirSync (fs.js:867:3) at Object.exports.wrapFsWithAsar.fs.mkdirSync (ELECTRON_ASAR.js:727:16) at Object.getIcon (C:\Users\XXX\.vscode\extensions\gruntfuggly.todo-tree-0.0.118\icons.js:28:16) at TreeNodeProvider.getTreeItem (C:\Users\XXX\.vscode\extensions\gruntfuggly.todo-tree-0.0.118\tree.js:386:43) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:469:761 at t.asPromise (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:50:385) at new Promise (<anonymous>) at Object.t.asPromise (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:50:353) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:469:718 at Array.map (<anonymous>) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:469:693

I think this is similar to #99. For some reason, context.storagePath is not defined, when according to the documents, should always exist. https://code.visualstudio.com/api/references/vscode-api#ExtensionContext

A temporary fix is to change all occurrences of context.storagePath to context.extensionPath in .vscode/extensions/Gruntfuggly.todo-tree-118.0.0/icon.js

I'll add a permanent fix...

oh yes, this indeed seems to work. thanks for the quick answer

Could you try something? Instead of using context.extensionPath can you try context.globalStoragePath. I think there is a mistake in the documentation for storagePath. Looking at what globalStoragePath seems to resolve to, I think that it should always work.

this seems to work, too. but with different behaviour. if you use extension patch and use a "new" icon in the settings a file todo-.svg is created in the extension folder
if you use globalStoragePath i have yet to find where the icon then is :)

oh yes, it is in C:\Users\\AppData\Roaming\Code\User\globalStorage\gruntfuggly.todo-tree\ then
so both solutions work, except the implemented :)

(ignore me!)

Thanks - it might aswell use global storage anyway - it's just a cache for the icon files, so it would be the same in each workspace.

no problem, ok then i leave it on global storage, too now, so the next update from you uses the same location

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  7Comments

alystair picture alystair  路  9Comments

WORMSS picture WORMSS  路  6Comments

diminutivesloop picture diminutivesloop  路  5Comments

luqiudi picture luqiudi  路  9Comments