2

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?

2 Answers 2

2

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.

7
  • 1
    Thanks...I found the entries...and now the really dumb question. My defaultPreferences.json file is not editable. A few settings show up in brackets.json but not all,in particular not the closetags options. How do I edit this defaultPreferences.json? Thanks again.
    – SavvyLIon
    Jun 8, 2016 at 15:52
  • Edit the file on the right, the default file shouldn't be touched ;) You'll have to add the entries you want manually. I'll update my answer when I get to my laptop. Jun 9, 2016 at 15:00
  • Thanks...I would appreciate detailed instructions on how to do it. I have added the entry manually to the right file at the end and in the middle, many times and after saving the file, closing Brackets and opening it again, I get an error message saying this is not a valid json file. When I remove the entries and repeat, I do not get the error message. A little bit frustrating.
    – SavvyLIon
    Jun 10, 2016 at 4:29
  • Oops, I managed to completely forget about this until now. Let me know if you have any questions still. Jun 10, 2016 at 5:25
  • Thanks! That worked...I thought I had done that before, but obviously I was typing in something wrong.
    – SavvyLIon
    Jun 11, 2016 at 16:22
2

Just use a boolean "false" for the value of the field name(s) if you want to shut that object to not function at all

 "closeTags": { 
        "whenOpening": false,
        "whenClosing": false
}

This sets the value of the closeTag field with Boolean defined values of two more objects which results with all auto-completing, closing tags to stop working.

After saving your changes, be sure the new file is loaded by restarting the application. All save does is saves your edits, any changes will not be seen until you restart the application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.