How to write a multi-line description for user snippets in VS Code










0















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:



https://i.stack.imgur.com/B61pT.png



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!










share|improve this question




























    0















    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:



    https://i.stack.imgur.com/B61pT.png



    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!










    share|improve this question


























      0












      0








      0








      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:



      https://i.stack.imgur.com/B61pT.png



      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!










      share|improve this question
















      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:



      https://i.stack.imgur.com/B61pT.png



      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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"
          ]






          share|improve this answer

























          • 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










          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
          );



          );













          draft saved

          draft discarded


















          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









          0














          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"
          ]






          share|improve this answer

























          • 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















          0














          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"
          ]






          share|improve this answer

























          • 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













          0












          0








          0







          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"
          ]






          share|improve this answer















          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"
          ]







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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

















          • 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



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo