syntax highlighting error of jsx in sublime text

眉间皱痕 提交于 2021-02-17 05:19:04

问题


I am trying to construct react components in sublime text, but the syntax highlighting is suggesting that I didn't do everything properly. Where is wrong?


回答1:


You are most likely using the Javascript syntax definition, which does not recognize inline HTML like this. To fix this, try the JSX.sublime-syntax definition from Sublime Text 4, which is in development now.

To install it, copy the .sublime-syntax file from the above link to your Packages/User directory, where Packages is the one opened when selecting Preferences → Browse Packages…:

  • Linux: ~/.config/sublime-text-3/Packages
  • OS X: ~/Library/Application Support/Sublime Text 3/Packages
  • Windows Regular Install: C:\Users<b>YourUserName\AppData\Roaming\Sublime Text 3\Packages
  • Windows Portable Install: InstallationFolder\Sublime Text 3\Data\Packages

You will also want to place the JSX Comments.tmPreferences file in the same directory so that comments work properly.

To use the new JSX syntax highlighting, select View → Syntax → User → JSX. Files with the .jsx suffix should be opened with the correct syntax automatically.



来源:https://stackoverflow.com/questions/64528395/syntax-highlighting-error-of-jsx-in-sublime-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!