Unable to delete a snippet that has an empty content string
Closed this issue · 13 comments
Ive accidentally created a snippet group , not named under any language specific or framework.
Is there a way i can go to the file and delete it.
where can i find the file storage location where all snippets are stored?
I wanna change it or remove it but can find it
thanks for help
Hi @goldcoders
Snippets are not stored in files but rather in the vscode global state, this is to ensure formatting is correct on the snippets object.
Very strange that you were able to create a group as they aren't supported yet in the current release, would you be able to send over a screenshot of what you're seeing? Also if you have any details on how I might reproduce it, would you mind sending that and i'll try and get a fix out asap.
Hi @goldcoders
Thanks for the detail.
Are you getting that error when you try and delete the "power" item?
As mentioned above snippets are not stored in files so there is no manual way to delete.
I dont know where you really storing the snippets,
You could have pick a folder where the major snippets are stored
Are you using sqlite? or any db? i dont know...
i tried to uninstall and remove all folders in vscode
$env:userprofile/.vscode
$env:appdata/Code
then reinstall vscode
and your plugin same thing, still appearing
and the only snippet i can delete are those that are gone ,
but the one on the group below JsonC
which is power and alt i
still cannot be deleted
this is a serious bug, i hope you take a look at it,
snippet should be easy to add and remove
Hi @goldcoders
As mentioned above it is stored in VSCodes global state. Here's a link to the documentation
https://code.visualstudio.com/api/references/vscode-api#ExtensionContext.globalState
The best way for me to see whats going in is for you to do an export, can you please search in the command pallet for export snippets and copy the result here.
Thanks, Devon
i tried to export it exported this
[
{
"created": "2021-01-31T15:48:54.659Z",
"name": "power",
"tags": [
"power"
],
"content": "",
"contentType": "jsonc"
},
{
"created": "2021-01-31T15:59:21.709Z",
"name": "alt i",
"tags": [
"alti"
],
"content": "",
"contentType": "jsonc"
}
]
Ahhh i've just had a play and i think i know what the issue is.
It seems the bug is that you can't delete a snippet that has empty content.
so could you please try and edit the snippet, right click in the sidebar and edit, add some content, save, then you should be able to delete.
I'll work on getting a fix up in the next week or so that prevents this issue from happening again.
i got this message
you cant edit a snippet group!
you need to click on the snippet itself not the group, i imported the content you sent over and i was able to edit it fine.
im doing the right thing , still cannot be edited,
i even try to export then re-import but i get this
Import failed, the json file you selected is invalid, please double check all fields.
Yeah so the import doesn't work if any items have an empty content string, please try importing this.
[
{
"created": "2021-01-31T15:48:54.659Z",
"name": "power",
"tags": [
"power"
],
"content": "asdf",
"contentType": "jsonc"
},
{
"created": "2021-01-31T15:59:21.709Z",
"name": "alt i",
"tags": [
"alti"
],
"content": "asdf",
"contentType": "jsonc"
}
]
Closing this for now, as i have not heard back. Let me know if this is still an issue.
Here is again: