alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
GNU General Public License v3.0
1.65k stars 163 forks source link

[FEATURE] dont create a bookmark file if no bookmark is created #575

Closed ctf0 closed 1 year ago

ctf0 commented 1 year ago

am not sure if this is a bug or a feature but atm the bookmark file will be created regardless if i have a bookmarks or not, is it possible to only create the file when a bookmark is added ?

alefragnani commented 1 year ago

Hi @ctf0 ,

No .vscode/bookmarks.json file is created anymore, if there is not bookmark in the workspace. This has been released a few years ago (https://github.com/alefragnani/vscode-bookmarks/issues/95), and it should still work.

I don't use bookmarks.saveBookmarksInProject that much, and just turned on for a few repos (in Windows and MacOS), and it seems to be working just fine. Maybe you have a scenario that it fails.

Could you please provide more details? What is the content of the file?

ctf0 commented 1 year ago

the file is empty, but on each workspace it gets created without any interaction of my side

alefragnani commented 1 year ago

Are you using single or multi-root workspaces? I couldn't repro on any of these scenarios.

BTW, empty bookmarks files seems odd, unless some error is happening. And by error I mean something in the extension trying to save the file or permissions.

ctf0 commented 1 year ago

Are you using single or multi-root workspaces?

single

Do you remember when you noticed such behavior?

only when the file shows up in git

What happens if you manually delete the empty file?

sometimes it would come back, will invistigate more on this

Is this file indexed in Git (if you are using Git or any other CVS)?

yes if the workspace .vscode folder is included

ctf0 commented 1 year ago

happend again, the file was created and i got this error

  ERR Cannot read properties of null (reading 'length'): TypeError: Cannot read properties of null (reading 'length')
    at /Users/xxx/.vscode-insiders/extensions/alefragnani.numbered-bookmarks-8.3.1/dist/extension-node.js:1:38062
    at t.updateStickyBookmarks (/Users/xxx/.vscode-insiders/extensions/alefragnani.numbered-bookmarks-8.3.1/dist/extension-node.js:1:38240)
    at /Users/xxx/.vscode-insiders/extensions/alefragnani.numbered-bookmarks-8.3.1/dist/extension-node.js:1:89660
    at d.invoke (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at b.deliver (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2029)
    at m.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1667)
    at P.$acceptModelChanged (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:96:11193)
    at u.N (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:11223)
    at u.M (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:10941)
    at u.H (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:10034)
    at u.G (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:9015)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:104:7803
    at d.invoke (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at b.deliver (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2029)
    at m.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1667)
    at g.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:72:14316)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:120:15779
    at d.invoke (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at b.deliver (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2029)
    at m.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1667)
    at g.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:72:14316)
    at MessagePortMain.<anonymous> (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:120:13935)
    at MessagePortMain.emit (node:events:526:28)
    at Object.MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:5:364)
    at Object.callbackTrampoline (node:internal/async_hooks:130:17)

the file content is

{
    "files": []
}
alefragnani commented 1 year ago

Hm, some error is happening while loading the bookmarks.

I remember seeing this Cannot read properties of null (reading 'length') error before. Not sure the reason/scenario, but I'll take a look

Thanks for reporting

ctf0 commented 1 year ago

i havent seen the issue for a while now, will close the ticket for now & will reopen if resurfaced again.