Closed MasouShizuka closed 2 months ago
That would require rewriting the plugin's UI to support somehow writing more than the snippet body and snippet prefix. Not impossible, but would take a certain amount of work, and make the plugin more complicated to use, while ease-of-use is one of its goals.
In my view, the benefit of being able to define a title different from the prefix is not big enough to warrant implementing this. For the very few cases where this might be useful, you can use the openInFile
keymap to edit the title directly.
After editing and saving an existing snippet, the title will be overwritten with the prefix.
For example, after saving the above snippet, it will become:
"M": {
"body": [
"local M = {}",
"${TM_SELECTED_TEXT}$0",
"return M"
],
"description": "This is a module template",
"prefix": "M"
},
In addition, it is also found that the part of luasnip
will disappear:
"Insert heading level 1": {
"prefix": [
".1",
"。1"
],
"body": "# ${TM_SELECTED_TEXT}",
"luasnip": {
"autotrigger": true
},
"description": "Insert heading level 1"
},
become:
".1 + 。1": {
"body": "# ${TM_SELECTED_TEXT}",
"description": "Insert heading level 1",
"prefix": [
".1",
"。1"
]
},
Is it possible to prevent other parts from being overwritten?
good point. Should be fixed.
After this fix, some keys that were not originally there appear after the snippet is saved, such as the above snippet:
"Module template": {
"body": [
"local M = {}",
"${TM_SELECTED_TEXT}$0",
"return M"
],
"description": "This is a module template",
"filetype": "lua",
"fullPath": "C:/Users/MasouShizuka/scoop/persist/vscode/data/user-data/User/snippets/lua.json",
"originalKey": "Module template",
"prefix": "M"
},
fixed
Checklist
Feature Requested
Currently defined snippets have the same title and prefix, but they can contain more information, for example:
This will look like:
So it would be great if could allow custom title and description.
Relevant Screenshot
No response