Skip to content Skip to sidebar Skip to footer

Syntax Highlighting Error Of Jsx In Sublime Text

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?

Solution 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.

Post a Comment for "Syntax Highlighting Error Of Jsx In Sublime Text"