microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.26k stars 29.3k forks source link

DOCTYPE is missing when using emmet to create html document #54680

Closed flower17 closed 6 years ago

flower17 commented 6 years ago

Issue Type: Bug

Steps to reproduce:

  1. Create empty html file.
  2. Open it in vscode editor.
  3. Type 'doc' (without quotes) and press tab.
  4. Html document template is created, but it has no doctype.

Actual result:

<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> 

Expected result - notice the doctype in the beginning of template:

<!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>

VS Code version: Code 1.25.0 (0f080e5267e829de46638128001aeb7ca2d6d50e, 2018-07-05T13:11:58.697Z) OS version: Windows_NT x64 10.0.17134

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (4 x 2592)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled| |Memory (System)|7.91GB (0.97GB free)| |Process Argv|C:\Program Files\Microsoft VS Code\Code.exe C:\liu\projects\drawBackground\index.html| |Screen Reader|no| |VM|0%|
Extensions (7) Extension|Author (truncated)|Version ---|---|--- vscode-eslint|dba|1.4.12 prettier-vscode|esb|1.5.0 vscode-highlight|fab|1.2.3 vs-color-picker|lih|0.7.0 emoji|Per|0.0.3 sass-indented|rob|1.4.9 vscode-import-cost|wix|2.7.2
ramya-rao-a commented 6 years ago

I believe this is intentional. ! would give you the same plus the doctype. See https://github.com/emmetio/snippets/blob/master/html.json#L142-L144

The Emmet Cheetsheet also says you get the doctype on using ! and not doc