在TextMate中,可以键入php<tab>
以插入<?php | ?>
(使用| here标记光标位置)。
我试图在php.json片段文件中在VSC中重新创建它:
"php tag": {
"prefix": "php",
"body": [
"<?php $1 ?>"
],
"description": "Insert <?php ?>"
}
问题是该片段不会显示,除非我已经在php标签内,这种方式会失败。
将代码段添加到HTML文件却无济于事。
有什么方法可以按照我想要的方式完成这项工作吗?
尝试将此添加到global.code-snippets
"PHP tag": {
"scope": "",
"prefix": "php",
"body": [
"<?php $1 ?>"
],
"description": "Insert php tags"
}
尝试这样做去file > preferences > user snippet
然后select New Global Snippets file
你被要求保存.code-snippets
扩展文件for the name of the file is free up to you
并输入你的代码片段配置,作为一个例子
"php tag": {
"prefix": "php",
"body": [
"<? php $1 ?>"
],
"description": "Insert <?php ?>"
}
并保存您的文件ENJOY