1. 程式人生 > >sublimeText3如何配置以支援jsx語法

sublimeText3如何配置以支援jsx語法

第一步:ctrl+shift+p進入外掛庫,然後點選install package安裝一個babel外掛就行了。

第二步:在編輯器的view->syntax->open all with current extension as ...->babel選擇javascript(babel)即可,此時程式碼已經有jsx語法提示了,但是很噁心的發現jsx包裹的html不支援聯想和emmet,那麼繼續下面的步驟

第三步:安裝RegReplace和Chain Of Command兩款外掛

第四步:在KeyBinding – Users中插入下面這段程式碼

{ "keys": ["tab"], "command": "expand_abbreviation_by_tab", "context": [{
        "operand": "source.js", 
        "operator": "equal", 
        "match_all": true, 
        "key": "selector"
    },{
        "key": "preceding_text", 
        "operator": "regex_contains", 
        "operand": "(\\b(a\\b|div|span|p\\b|button)(\\.\\w*|>\\w*)?)", 
        "match_all": true
    },{
        "key": "selection_empty", 
        "operator": "equal", 
        "operand": true, 
        "match_all": true
    }]
  }


以上就是全部啦,還有一些細節歡迎大家補充~!!