最近常在 vscode 寫 react,由於 react 是使用 jsx 語法,發現 emmet 在 js 檔案無法正常的自動產生 html

紀錄一下後來查到的解決方式

進入 vscode 的  Preference > User Settings

加入以下的設定

"emmet.includeLanguages": {
    "javascript": "javascriptreact"
},
"files.associations": {
   "*.js": "javascriptreact"
}

 

參考資料:

https://github.com/Microsoft/vscode/issues/4962

Leave a Reply