htmltagsbracketsadobe-brackets

turning off auto completion of matching brackets in Adobe Brackets


I have only just started using Adobe Brackets for HTML development. As a programming newcomer, I am still not savvy enough to look in all the right places to change defaults. When I type a beginning tag in Brackets (HTML) like < p >, the editor automatically adds the ending tag < /p >, assuming that I will enter text between the two tags. So I get < p > < /p >. Often I want to put the tags around existing text and do not want the auto completion of the end tag upon entering the beginning tag. How do I change the default in Adobe Brackets so that I do not get the auto-completion of the end tag?


Solution

  • You can do this by setting the dontCloseTags option in the Brackets preferences file.

    1. Go to the Debug menu and select Open Preferences File. You will see a side-by-side view of defaultPreferences.json on the left and brackets.json on the right. These are Brackets' default settings and your settings file, respectively. defaultPreferences.json lists all the possible options that can be set and their default values, but the file itself can't be modified.
    2. Look at the comments in defaultPreferences.json for closeTags. What we care about is dontCloseTags.
    3. Set dontCloseTags inside of closeTags. For example, my defaultPreferences.json file looks like this:

      {  
          "fonts.fontSize": "12px",  
          "fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",  
          "themes.theme": "dark-theme",  
          "useTabChar": true,  
          "tabSize": 5  
      }
      

      And so I would set it up like this, adding a comma after the last entry before starting a new one below:

      {  
          "fonts.fontSize": "12px",  
          "fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",  
          "themes.theme": "dark-theme",  
          "useTabChar": true,  
          "tabSize": 5,  
          "closeTags": {  
              "dontCloseTags": ["p", "img"],
              "whenOpening": true
          }  
      }  
      

      I set whenOpening to true because I found that sometimes Brackets won't autocomplete any tags without me asserting that value, even though it's the default.

    4. Press Ctrl + S to save your preferences and then close the two files.

    5. Click on the icon next to the settings icon next to the Left heading in the sidebar, then select No Split. This will remove the two columns.

    I hope this helps, and have fun looking at the other settings in defaultPreferences.json, since Brackets won't add a front-end for those settings for a while (it's in the works). Just make sure to match the syntax exactly as it is in defaultPreferences.json (except for the comments). JSON also wants commas between stuff inside {} and [], but do not add a trailing comma after the last item in each grouping. If the option you want is inside another option (for example, dontCloseTags is inside of closeTags{}), you need to include the main option and its grouping symbol thing.