我希望能够在 Sublime text 2 中的 js
/jsx
文件中自动补全 HTML 标签。我已经安装了 Babel-sublime但它不支持 HTML 自动完成。
还有其他选择吗?
编辑:有什么好的包可以让 HTML 自动完成在 js
文件中正常工作吗?即 Sublime text 2 中 js
文件中的 Emmet
。不一定是 jsx
最佳答案
因此,我通过将以下内容添加到用户 的键绑定(bind)中,让
emmet
在 Sublime Text 2 中处理 js/jsx
文件(首选项 ->键绑定(bind) - 用户)
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
"operand": "source.js",
"operator": "equal",
"match_all": true,
"key": "selector"
},
// run only if there's no selected text
{
"match_all": true,
"key": "selection_empty"
},
// don't work if completion popup is visible and you
// want to insert completion with Tab. If you want to
// expand Emmet with Tab even if popup is visible --
// remove this section
{
"operand": false,
"operator": "equal",
"match_all": true,
"key": "auto_complete_visible"
},
{
"match_all": true,
"key": "is_abbreviation"
}
] } `
关于javascript - Sublime Text 2 js/jsx 文件中的 html 自动完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31517128/