Where are the default Emmet settings in Visual Studio Code?
Asked Answered
S

4

7

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.

Silken answered 3/9, 2017 at 0:28 Comment(0)
U
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"

Undeviating answered 3/9, 2017 at 19:44 Comment(3)
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.Silken
Maybe you should edit your question to specify what problem you are trying to solve?Undeviating
My question specifically asks for what I'm looking for -- the file that contains VS Code's default emmet settings.Silken
W
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

Wakerife answered 26/1, 2020 at 3:8 Comment(0)
A
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.

Arevalo answered 8/9, 2020 at 12:14 Comment(0)
A
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.

Apron answered 11/8, 2021 at 1:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.