6

Where are the default Emmet settings in Visual Studio Code (v1.15.1)?

I'm looking for the file that makes Visual Studio Code expand the Emmet HTML abbreviation ! into:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>

</body>
</html>

I'm trying to workaround some problems that happened since Visual Studio Code started being shipped with Emmet 2.0 by default.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Brian Zelip
  • 2,909
  • 4
  • 33
  • 45

4 Answers4

3

You can override it with custom snippets.

File settings.json (Ctrl + ,):

"emmet.extensionsPath": PATH_TO_YOUR_NEW_FOLDER_WITH_SNIPPETS

In this folder, create file snippets.json:

Emmet 2.0: Custom Emmet snippets in HTML should be a valid abbreviation. For example: use ul>li instead of <ul><li></li></ul>.

If you want to have just text and not markup in your snippet then use the {}notation:

{<ul><li></li></ul>}

{
    "variables": {
        "lang": "en"
    },
    "html": {
        "snippets": {
            "!": "!!!+html[lang=${lang}]>(head>meta[charset=UTF-8]+title{Document})+body"
        }
    }
}

Visual Studio Code documentation: "Using custom Emmet snippets"

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alex
  • 59,571
  • 22
  • 137
  • 126
  • 5
    Thanks for your response, but I'm not asking about custom snippets, rather I'm looking for the Code file that contains Code's default emmet settings. – Brian Zelip Sep 04 '17 at 15:23
  • 2
    Maybe you should edit your question to specify what problem you are trying to solve? – Alex Sep 06 '17 at 09:59
  • 8
    My question specifically asks for what I'm looking for -- the file that contains VS Code's default emmet settings. – Brian Zelip Sep 09 '17 at 15:43
3

From this Reddit answer:

I'm not sure where they are located on your filesystem when Visual Studio Code is installed, but all the default HTML snippets are here:

https://github.com/emmetio/snippets/blob/master/html.json

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kyle Delaney
  • 11,616
  • 6
  • 39
  • 66
1

You can find the default Emmet settings in the defaultSettings.json file.

However, it's easier to open Visual Studio Code, hit Ctrl + Shift + P and type: "defaultSettings" to access this configuration file.

This directly answers your question, but it won't necessarily help you solve your problem.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
sale108
  • 577
  • 7
  • 22
1

Well, unfortunately you can't get the default Emmet settings, since the plugin is bundled with VS Code itself. You can view default Emmet files in editor's source code: https://github.com/microsoft/vscode/tree/main/extensions/emmet

As Peter Mortensen mentioned above, you can only add or customize Emmet snippets with extra file. It's explained in details here: https://code.visualstudio.com/docs/editor/emmet

Hope it satisfies your interest in this matter.

Raymoff
  • 152
  • 5