首先确认你已经安装了Emmet插件
打开 Sublime Text,依次点击: Sublime Text -> Preferences -> Package Settings -> Emmet -> Key Bindings - User,然后将下列内容粘贴到打开的文件中。
[
{
"keys": [
"super+e"
],
"args": {
"action": "expand_abbreviation"
},
"command": "run_emmet_action",
"context": [{
"key": "emmet_action_enabled.expand_abbreviation"
}]
},{
"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,
"k": "selection_empty"
},
// don't work if there are active tabstops
{
"operator": "equal",
"operand": false,
"match_all": true,
"key": "has_next_field"
},
// 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"
}
]
}
]
将文件保存后重启 Sublime Text,此时编写 React 项目应该可以正常进行补全。但是我的Sublime在完成以上步骤后仍然不能补全,通过 ctrl + ` 调出Sublime 的控制台发现如下错误:AttributeError: ‘module’ object has no attribute 'JSContext。通过在网上查找资料发现是PyV8的问题,然后解决该问题。
第一步,下载PyV8,下载地址为:PyV8下载地址,选择对应操作系统的版本下载并解压。
第二步,将PyV8放到指定目录下,目录为:/Users/用户名/Library/Application Support/Sublime Text 3/Installed Packages
,操作完成后目录结构如下图所示。
经过以上几个步骤后,我的 Sublime Text 成功使用 Tab键补全React代码。
本文地址:https://blog.csdn.net/SwiftLess/article/details/107147498
如对本文有疑问, 点击进行留言回复!!
G-Grid Coloring 2020牛客暑期多校训练营(第六场)
【Unity2017】如何将ArrayList中的元素打乱顺序。
2020牛客暑期多校训练营(第六场)H Harmony Pairs —— 记忆化搜索,有丶东西
从C# EntityFramework三层架构使用VS2013+EF6.0+MVC
网友评论