gpt4 book ai didi

visual-studio-code - Visual Studio Code 中带有缩进的代码段

转载 作者:行者123 更新时间:2023-12-03 10:34:26 25 4
gpt4 key购买 nike

我正在尝试在 Visual Studio Code 中创建一个片段。这有效,但缺少缩进:

我的片段:

"HTML structure": {
"prefix": "html",
"body": [
"<!DOCTYPE html>",
"<html lang='fr'>",
"<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>$1</title>",
"</head>",
"<body>",
"$2",
"</body>",
"</html>"
],
"description": "Base template for html file"
}

你看到的是:

<!DOCTYPE html>
<html lang='fr'>
<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>test</title>
</head>
<body>
test
</body>
</html>

我想要什么:

<!DOCTYPE html>
<html lang='fr'>
<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></title>
</head>
<body>
</body>
</html>

最佳答案

我认为更合适的方式是使用 \t而不是空间来保持文档缩进。

"\t<meta charset='UTF-8'>",

关于visual-studio-code - Visual Studio Code 中带有缩进的代码段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44787009/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com