ReactJS JSX自动完成不再起作用

问题描述

我曾经能够键入div,然后按tab键,那么sublime会自动完成并输出<div></div>。与组件相同。我将输入MyComponent并按tab键,然后sublime会自动完成<MyComponent></MyComponent>。从今天起,这对我不再起作用。有什么想法吗?

我尝试找到解决方案,但未成功。下面是我尝试过的快捷键绑定,但是不起作用。

{ "keys": ["tab"],"command": "expand_abbreviation_by_tab","context":
        [
            { "operand": "source.js","operator": "equal","match_all": true,"key": "selector" },{ "match_all": true,"key": "selection_empty" },{ "operator": "equal","operand": false,"key": "has_next_field" },{ "operand": false,"key": "auto_complete_visible" },"key": "is_abbreviation" }
        ]
    }

解决方法

今天Emmet软件包已更新为Emmet2,并且上述键绑定需要稍作调整。命令属性应该是emmet_expand_abbreviation而不是expand_abbreviation_by_tab,并且Emmet2现在在您键入时显示一个弹出窗口,因此需要注释掉最后两行。 这对我有用:

{ "keys": ["tab"],"command": "emmet_expand_abbreviation","context":
    [
      { "operand": "source.js","operator": "equal","match_all": true,"key": "selector" },{ "match_all": true,"key": "selection_empty" },{ "operator": "equal","operand": false,"key": "has_next_field" },// { "operand": false,"key": "auto_complete_visible" },// { "match_all": true,"key": "is_abbreviation" }
    ]
  }

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...