Search code examples
javascripttwitter-bootstrapvisual-studio-codecode-snippets

Bootstrap 3 Snippets in visual studio code


I am using visual studio code, when call any bs3 snipper , it creates extra top and bottom empty line. Someone please show me how can I prevent that?

enter image description here

green line are one I want to remove automatically


Solution

  • To do that you need to edit the bootstrap-3 snippet file snippets.json under the following path C:\Users\<Username>\.vscode\extensions\wcwhitehead.bootstrap-3-snippets-0.1.0\snippets and remove first and last \n from each snippet as below example (restatr VS Code after update).
    Original snippet:

     "bs3-alert:danger": {
            "prefix": "bs3-alert:danger",
            "body": "\n<div class=\"alert alert-danger\">\n\t<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>\n\t<strong>${1:Title!}</strong> ${2:Alert body ...}\n</div>\n",
            "description": "Danger Alert Box",
            "scope": ""
     },
    

    Updated snippet:

    "bs3-alert:danger": {
            "prefix": "bs3-alert:danger",
            "body": "<div class=\"alert alert-danger\">\n\t<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button>\n\t<strong>${1:Title!}</strong> ${2:Alert body ...}\n</div>",
            "description": "Danger Alert Box",
            "scope": ""
     },