1.JsFormatjavascript
功能:能按照當前Sublime配置去格式化Javascript代碼
安裝:
PC上ctrl+shift+p(MacCmd+shift+p)打開面板輸入JsFormat安裝.
配置:
打開preferences -> Package Settings -> JsFormat -> Setting - Users,輸入如下代碼:java
{ "e4x": true, // jsformat options "format_on_save": true, }
便可保存時自動格式化,並支持 jsx 類型文件.react
2.Babel數組
功能:支持ES6和React JSX語法定義,我通常用它替代Sublime自帶的js語法定義。
安裝:
PC上ctrl+shift+p(MacCmd+shift+p)打開面板輸入Babel安裝.
配置:
打開.js, .jsx 後綴的文件;打開菜單view, Syntax -> Open all with current extension as… -> Babel -> JavaScript (Babel),選擇babel爲默認 javascript 打開syntax,便可看到對react的語法高亮。babel
3.SublimeLinter即其系列spa
功能:用來檢查語法錯誤的插件,對於寫代碼來講很是重要,能夠避免不少低級錯誤。
安裝:
PC上ctrl+shift+p(MacCmd+shift+p)打開面板輸入sublimeLinter-jsx安裝(依賴於 sublimeLinter)插件3.1 SublimeLinter-jshint功能:
js語法檢查.
安裝:
PC上ctrl+shift+p(MacCmd+shift+p)打開面板輸入sublimeLinter-jshint安裝(依賴於 sublimeLinter)code3.2 SublimeLinter-jsxhint功能:
React代碼語法檢查
安裝:
PC上ctrl+shift+p(MacCmd+shift+p)打開面板輸入sublimeLinter-jsxhint安裝(依賴於 sublimeLinter)orm
4.Emmetip
功能: jsx 文件中快速經過 emmet 編寫自定義組件。
安裝:
PC上ctrl+shift+p(MacCmd+shift+p)打開面板輸入emmet安裝
配置: 打開 preferences -> Key bindings - Users,先用[]擴展爲數組,而後把下面代碼複製到[]內部。
{ "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", "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 }] }
使用super+e觸發 emmet,自動補齊;