How to write a multi-line description for user snippets in VS Code
I tried to create my own user snippet for pascal in VS Code.
It worked fine and the multi-line descriptions I wrote were displayed
correctly.
But after a while, like a month, the descriptions with multiple lines aren't working anymore.
The problem may be the code for the multi-line descriptions because descriptions with only one row still works and displays correct.
However the multi-line descriptions aren't displayed correctly and get replaced with a 0 instead of the description I wrote.
This is how the multi-line descriptions are displayed:
Instead of my description there is a 0 and I don't know why because it worked fine a month ago.
This is the code I used:
"SetValue":
"prefix": "SetValue",
"body": "SetValue($1:val:Integer, $2:id:Integer);",
"description": [
"Parameter:r",
" val...descr",
" id....descr",
"r",
"result:r",
" 0 : false descr",
" 1 : true descr"
]
I hope I have expressed myself understandably and you may can help me with this problem. Thanks for your attention!
visual-studio-code code-snippets
add a comment |
I tried to create my own user snippet for pascal in VS Code.
It worked fine and the multi-line descriptions I wrote were displayed
correctly.
But after a while, like a month, the descriptions with multiple lines aren't working anymore.
The problem may be the code for the multi-line descriptions because descriptions with only one row still works and displays correct.
However the multi-line descriptions aren't displayed correctly and get replaced with a 0 instead of the description I wrote.
This is how the multi-line descriptions are displayed:
Instead of my description there is a 0 and I don't know why because it worked fine a month ago.
This is the code I used:
"SetValue":
"prefix": "SetValue",
"body": "SetValue($1:val:Integer, $2:id:Integer);",
"description": [
"Parameter:r",
" val...descr",
" id....descr",
"r",
"result:r",
" 0 : false descr",
" 1 : true descr"
]
I hope I have expressed myself understandably and you may can help me with this problem. Thanks for your attention!
visual-studio-code code-snippets
add a comment |
I tried to create my own user snippet for pascal in VS Code.
It worked fine and the multi-line descriptions I wrote were displayed
correctly.
But after a while, like a month, the descriptions with multiple lines aren't working anymore.
The problem may be the code for the multi-line descriptions because descriptions with only one row still works and displays correct.
However the multi-line descriptions aren't displayed correctly and get replaced with a 0 instead of the description I wrote.
This is how the multi-line descriptions are displayed:
Instead of my description there is a 0 and I don't know why because it worked fine a month ago.
This is the code I used:
"SetValue":
"prefix": "SetValue",
"body": "SetValue($1:val:Integer, $2:id:Integer);",
"description": [
"Parameter:r",
" val...descr",
" id....descr",
"r",
"result:r",
" 0 : false descr",
" 1 : true descr"
]
I hope I have expressed myself understandably and you may can help me with this problem. Thanks for your attention!
visual-studio-code code-snippets
I tried to create my own user snippet for pascal in VS Code.
It worked fine and the multi-line descriptions I wrote were displayed
correctly.
But after a while, like a month, the descriptions with multiple lines aren't working anymore.
The problem may be the code for the multi-line descriptions because descriptions with only one row still works and displays correct.
However the multi-line descriptions aren't displayed correctly and get replaced with a 0 instead of the description I wrote.
This is how the multi-line descriptions are displayed:
Instead of my description there is a 0 and I don't know why because it worked fine a month ago.
This is the code I used:
"SetValue":
"prefix": "SetValue",
"body": "SetValue($1:val:Integer, $2:id:Integer);",
"description": [
"Parameter:r",
" val...descr",
" id....descr",
"r",
"result:r",
" 0 : false descr",
" 1 : true descr"
]
I hope I have expressed myself understandably and you may can help me with this problem. Thanks for your attention!
visual-studio-code code-snippets
visual-studio-code code-snippets
edited Nov 14 '18 at 15:31
Mark
13.9k34058
13.9k34058
asked Nov 14 '18 at 9:10
Nico Win.Nico Win.
32
32
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I can't explain why it changed but it appears to accept only one string (and not an array of strings). But you can still build up one string - a little ugly but it works:
"description":
"Parameter:rval...descr id....descrrresult:r 0 : false descr 1 : true descr"
Now it will display in the suggestions panel as you expect.
Edit: v1.31 fixed this so you can use an array of strings rather than one long string. Snippet descriptions
When authoring snippets with long descriptions, in the past you were
forced to write a long single string. There was no support for using
an array as you could for body. This has now changed and long
descriptions can be written using string arrays.
"prefix": "happy",
"body": "#Happy Coding!",
"description": [
"First Line",
"Second Line",
"Third Line"
]
Thanks for your reply. I thought to do this like you said. I tried your code and it works fine. First I thought there are maybe other ways as the one you meant but I guess this is the only one. However thanks for your reply it's working fine but as you said it's a little bit ugly.
– Nico Win.
Nov 14 '18 at 15:47
I think it is the best you can do. Don't forget to accept the answer if you found it helpful. Thanks.
– Mark
Nov 14 '18 at 16:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296517%2fhow-to-write-a-multi-line-description-for-user-snippets-in-vs-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I can't explain why it changed but it appears to accept only one string (and not an array of strings). But you can still build up one string - a little ugly but it works:
"description":
"Parameter:rval...descr id....descrrresult:r 0 : false descr 1 : true descr"
Now it will display in the suggestions panel as you expect.
Edit: v1.31 fixed this so you can use an array of strings rather than one long string. Snippet descriptions
When authoring snippets with long descriptions, in the past you were
forced to write a long single string. There was no support for using
an array as you could for body. This has now changed and long
descriptions can be written using string arrays.
"prefix": "happy",
"body": "#Happy Coding!",
"description": [
"First Line",
"Second Line",
"Third Line"
]
Thanks for your reply. I thought to do this like you said. I tried your code and it works fine. First I thought there are maybe other ways as the one you meant but I guess this is the only one. However thanks for your reply it's working fine but as you said it's a little bit ugly.
– Nico Win.
Nov 14 '18 at 15:47
I think it is the best you can do. Don't forget to accept the answer if you found it helpful. Thanks.
– Mark
Nov 14 '18 at 16:15
add a comment |
I can't explain why it changed but it appears to accept only one string (and not an array of strings). But you can still build up one string - a little ugly but it works:
"description":
"Parameter:rval...descr id....descrrresult:r 0 : false descr 1 : true descr"
Now it will display in the suggestions panel as you expect.
Edit: v1.31 fixed this so you can use an array of strings rather than one long string. Snippet descriptions
When authoring snippets with long descriptions, in the past you were
forced to write a long single string. There was no support for using
an array as you could for body. This has now changed and long
descriptions can be written using string arrays.
"prefix": "happy",
"body": "#Happy Coding!",
"description": [
"First Line",
"Second Line",
"Third Line"
]
Thanks for your reply. I thought to do this like you said. I tried your code and it works fine. First I thought there are maybe other ways as the one you meant but I guess this is the only one. However thanks for your reply it's working fine but as you said it's a little bit ugly.
– Nico Win.
Nov 14 '18 at 15:47
I think it is the best you can do. Don't forget to accept the answer if you found it helpful. Thanks.
– Mark
Nov 14 '18 at 16:15
add a comment |
I can't explain why it changed but it appears to accept only one string (and not an array of strings). But you can still build up one string - a little ugly but it works:
"description":
"Parameter:rval...descr id....descrrresult:r 0 : false descr 1 : true descr"
Now it will display in the suggestions panel as you expect.
Edit: v1.31 fixed this so you can use an array of strings rather than one long string. Snippet descriptions
When authoring snippets with long descriptions, in the past you were
forced to write a long single string. There was no support for using
an array as you could for body. This has now changed and long
descriptions can be written using string arrays.
"prefix": "happy",
"body": "#Happy Coding!",
"description": [
"First Line",
"Second Line",
"Third Line"
]
I can't explain why it changed but it appears to accept only one string (and not an array of strings). But you can still build up one string - a little ugly but it works:
"description":
"Parameter:rval...descr id....descrrresult:r 0 : false descr 1 : true descr"
Now it will display in the suggestions panel as you expect.
Edit: v1.31 fixed this so you can use an array of strings rather than one long string. Snippet descriptions
When authoring snippets with long descriptions, in the past you were
forced to write a long single string. There was no support for using
an array as you could for body. This has now changed and long
descriptions can be written using string arrays.
"prefix": "happy",
"body": "#Happy Coding!",
"description": [
"First Line",
"Second Line",
"Third Line"
]
edited Feb 6 at 22:36
answered Nov 14 '18 at 15:18
MarkMark
13.9k34058
13.9k34058
Thanks for your reply. I thought to do this like you said. I tried your code and it works fine. First I thought there are maybe other ways as the one you meant but I guess this is the only one. However thanks for your reply it's working fine but as you said it's a little bit ugly.
– Nico Win.
Nov 14 '18 at 15:47
I think it is the best you can do. Don't forget to accept the answer if you found it helpful. Thanks.
– Mark
Nov 14 '18 at 16:15
add a comment |
Thanks for your reply. I thought to do this like you said. I tried your code and it works fine. First I thought there are maybe other ways as the one you meant but I guess this is the only one. However thanks for your reply it's working fine but as you said it's a little bit ugly.
– Nico Win.
Nov 14 '18 at 15:47
I think it is the best you can do. Don't forget to accept the answer if you found it helpful. Thanks.
– Mark
Nov 14 '18 at 16:15
Thanks for your reply. I thought to do this like you said. I tried your code and it works fine. First I thought there are maybe other ways as the one you meant but I guess this is the only one. However thanks for your reply it's working fine but as you said it's a little bit ugly.
– Nico Win.
Nov 14 '18 at 15:47
Thanks for your reply. I thought to do this like you said. I tried your code and it works fine. First I thought there are maybe other ways as the one you meant but I guess this is the only one. However thanks for your reply it's working fine but as you said it's a little bit ugly.
– Nico Win.
Nov 14 '18 at 15:47
I think it is the best you can do. Don't forget to accept the answer if you found it helpful. Thanks.
– Mark
Nov 14 '18 at 16:15
I think it is the best you can do. Don't forget to accept the answer if you found it helpful. Thanks.
– Mark
Nov 14 '18 at 16:15
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296517%2fhow-to-write-a-multi-line-description-for-user-snippets-in-vs-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown