Built-in snippet not working in VS Code for React

Viewed 14353

I am coding a React page with VS Code.

Suddenly, some snippets like rfce started not working even if it's never given me problems. I don't know what's wrong.

picture of before

enter image description here

picture of now

enter image description here

What I did recently was just updated react-router-dom to version 5.2.0 and npm install it.

6 Answers

React snippets are not built-in. That one for example comes from this extension.

Make sure you have it installed and enabled, and that you are working in a file with the proper file extension for them to work.

I went through the same thing. You can try uninstalling and then installing the extension again

Those React snippets what you are talking about are not built-in, those snippets are coming from an extension. That extension stopped working for you because you may change some of your settings.

  1. Make sure you have it installed and enabled, and that, you are working in a file with the proper file extension for them to work (try: .jsx & .tsx).
  2. If they are still not working, which was the case at me also, check your settings, because some of the settings can interfere, and make the extension stop working.
  3. Open settings.json by: CTRL + SHIFT + p , type: settings.json, select: "Open settings (JSON)"
  4. Check in the settings.json file if the following setttings are different than mine:
    "editor.snippetSuggestions": "top",     /*make sure this is NOT "none"*/
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.quickSuggestions": {
      "other": true,
      "comments": false,
      "strings": true
    },
    "editor.wordBasedSuggestions": true,
    "html.suggest.html5": false,
    "typescript.suggest.paths": false,
    "javascript.suggest.paths": false,

As fast experiment you can copy the whole code, paste it at the end of the settings.json, save it, restart VSC.
If it solved your issue, you can sort the commands one-by-one, to find out which caused the issue of yours.

  1. It might not work, if you use the same file name like Rfce.js
  2. Ensure that the file has extension js, ts etc.,
  3. Uninstalling and installing React snippet from VSCode Extension might work.
  4. Go to Preference - Settings - Extensions - Search for React Snippet and check if the values are correctly checked in.

It seems like that React snippet is not working properly, try to download it manually and install it through the link to the vss file and now install from Vss option in the extension section

If on windows, use -rfce instead of _rfce. This worked for me!

Related