emmetio / sublime-text-plugin

The essential toolkit for web-developers
https://emmet.io
MIT License
255 stars 30 forks source link

Change from double quotes to single quotes #163

Closed ozgrozer closed 3 years ago

ozgrozer commented 3 years ago

Even though I have this setting in my Emmet.sublime-settings file, it still adds double quotes when I press the tab key. I think something broke in one of the last updates but I'm not sure.

Is there any workaround to fix this?

{
  "syntaxProfiles": {
    "jsx": {
      "attr_quotes": "single",
      "self_closing_tag": true
    }
  }
}
sergeche commented 3 years ago

Config format has been changed: https://github.com/emmetio/sublime-text-plugin#adding-custom-emmet-snippets

It should be something like this:

{
    "config": {
        "jsx": {
            // https://github.com/emmetio/emmet/blob/master/src/config.ts#L110
            "options": {
                "output.attributeQuotes": "single"
            }
        }
}
ozgrozer commented 3 years ago

I didn't know about that. All of my research was leading me to the same answer, the one in my previous message. But thank you, it's working now.

cochinet commented 3 years ago

Hi there, I'm missing something here and I'm having a hard time trying to figure this out. Maybe you guys can help me :)

I had this in my syntaxProfiles.json

{
    // force XHTML profile for HTML syntax
    "html": "xhtml",

    // create our own profile for XML
    "xml": {
        "filters": "html, ctp",
        "tag_case": "upper",
        "attr_quotes": "single"
    }
}

Can't figure out how to upgrade it to the new config structure.

Thanks 👍

sergeche commented 3 years ago

@cochinet my answer above shows sample config for single quotes

cochinet commented 3 years ago

@sergeche Sure, thanks, I got that working, the thing that I'm having trouble with is making that configuration work with ctpfiles. Any help would be very appreciated. Thanks.

[update] -- Got it working after a few more attempts :)

{
    "tag_preview": true,
    "markup_style": "xhtml",
    "attribute_quotes": "single",
    "config": {
        "markup": {
            "snippets": {
            },
            "options": {
                "output.attributeQuotes": "single",
                "output.selfClosingStyle": "xhtml"
            }
        }
    }
}