vscode-react-native icon indicating copy to clipboard operation
vscode-react-native copied to clipboard

Syntax coloring not working.

Open awclives opened this issue 10 years ago • 52 comments

I am trying to use VS Code for a simple react native project. I installed the react native extension, and it seemed to load correctly, and it also recognizes the js files as react jsx. However, the syntax color is not working correctly. For instance, in the attached screenshot, View and Text are white.

Let me know what other information I can provide.

screen shot 2016-03-04 at 1 57 51 pm

awclives avatar Mar 04 '16 20:03 awclives

If you look in the bottom right of your window, it says "JavaScript". If you click on that, you should be able to change it to "JavaScript React" which supports the highlighting for JSX constructs.

Unfortunately you will need to modify this setting manually for all files which end in .js rather than .jsx because the default colourising is based on file extension.

MSLaguana avatar Mar 04 '16 20:03 MSLaguana

If you would like all .js files globally to be considered as .jsx and support JSX colorization, you can install the js-is-jsx extension.

MSLaguana avatar Mar 04 '16 20:03 MSLaguana

Hmm, it still doesn't work for me. Attached a screenshot with the language mode changed to JavaScript React. I must be missing something?

screen shot 2016-03-04 at 2 27 21 pm

awclives avatar Mar 04 '16 20:03 awclives

What version of VS Code are you running?

joshuaskelton avatar Mar 04 '16 20:03 joshuaskelton

0.10.9

awclives avatar Mar 04 '16 20:03 awclives

@awclives Could you please send us a screenshot of the contents of the folders .vscode\typings\react and .vscode\typings\react-native of you workspace? So we can check if the extension copied the correct files to those locations.

digeff avatar Mar 07 '16 16:03 digeff

I don't have a typings directory. screen shot 2016-03-07 at 12 55 43 pm

awclives avatar Mar 07 '16 18:03 awclives

@awclives Sorry about the misunderstanding. I meant the .vscode folder inside your react-native project next to the android, App, ios, and node_modules folders. Can you please show us that one?

digeff avatar Mar 07 '16 19:03 digeff

Hope this does it.

screen shot 2016-03-07 at 1 30 32 pm

awclives avatar Mar 07 '16 19:03 awclives

It appears that the other jsx extension you have installed overwrites the colorization provided by VS Code. Try this:

  1. Uninstall the jsx extension by TwentyChung
  2. Change your theme to Monokai
  3. Restart VS Code

joshuaskelton avatar Mar 07 '16 19:03 joshuaskelton

View and Text are still white.
i also uninstalled and reinstalled the react native extension.

screen shot 2016-03-07 at 2 34 44 pm

awclives avatar Mar 07 '16 20:03 awclives

Did you switch the language to JavaScript React?

Edit: VS Code 0.10.10 was just released and has improved(or at least more consistent) JSX colorization.

joshuaskelton avatar Mar 07 '16 21:03 joshuaskelton

working fine now. thank you.

awclives avatar Mar 09 '16 03:03 awclives

Hi, I am also getting the same problem I am sharing my screen In that screen mongoose word should be blue color but is showing as white. I dont understand why it is showing like that?

prudhviraju255 avatar Aug 22 '18 12:08 prudhviraju255

white

prudhviraju255 avatar Aug 22 '18 12:08 prudhviraju255

Hi @prudhviraju255, syntax highlighting as well as code hinting is not a part of React Native Tools extension anymore. I'd suggest you to file your question to vscode tracker.

ruslan-bikkinin avatar Aug 22 '18 13:08 ruslan-bikkinin

Is this called syntax coloring? I thought it was code colouring

CoderTeam1 avatar Nov 06 '20 13:11 CoderTeam1

guys i found a solution to fix this.

Open your VS code and press the settings icon at the bottom left. Then come to the color theme section and choose the dark+ theme. at least my problem was solved this way, maybe you can solve it with this way too. Have a good day everyone!

veilinmyveins avatar Sep 16 '21 10:09 veilinmyveins

@reelkaeshi is right. I had the same issue, I had my colour theme set as "Dark" but it needs to be "Dark+", then you'll get all of the correct highlighting. Thanks!

michaelcoughlan avatar Dec 13 '21 11:12 michaelcoughlan

guys i found a solution to fix this.

Open your VS code and press the settings icon at the bottom left. Then come to the color theme section and choose the dark+ theme. at least my problem was solved this way, maybe you can solve it with this way too. Have a good day everyone!

Thanks it worked

kiisi avatar Mar 06 '22 00:03 kiisi