【问题标题】:sublime text 2 html autocompletion in js/jsx filesjs/jsx 文件中的 sublime text 2 html 自动补全
【发布时间】:2023-03-07 22:47:01
【问题描述】:
我希望能够在 Sublime text 2 中的 js/jsx 文件中自动完成 HTML 标记。我已经安装了 Babel-sublime,但它不支持 HTML 自动完成。
还有其他选择吗?
编辑:HTML 自动完成功能在js 文件中运行良好的任何好的包?即 Emmet 在 Sublime 文本 2 中的 js 文件中。不必是 jsx
【问题讨论】:
标签:
javascript
autocomplete
reactjs
sublimetext2
emmet
【解决方案1】:
因此,通过将以下内容添加到用户 (Preferences -> Key Bindings - User) 的键绑定中,我让 emmet 为 Sublime Text 2 中的 js/jsx 文件工作
{
"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"
}
]
}
`