17

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.

2
  • Please upload pictures of the errors prompted in vscode if you have any. Please also upload pictures of what the expected outcome and the current outcome (what you mean with "not working") is. Some snippets may change their behaviour across versions. Commented Feb 9, 2021 at 12:04
  • 2
    Install ES7+ React/Redux/React-Native snippets from Extensions and make sure it is Enabled. Commented Feb 3, 2022 at 7:04

12 Answers 12

25

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.

Sign up to request clarification or add additional context in comments.

Comments

10

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

Comments

5

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 installed the extension and enabled. Also that: you are working in a file which has the proper file extension (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 settings 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 a fast experiment you can copy the whole code, paste it at the end of the settings.json, save it, restart VSC, and try it out if now the snippets are working.
If it solved your issue, you can sort the commands one-by-one out, to find out which caused the issue of yours.

Comments

3

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

Comments

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

Comments

1

I think you unfortunately uninstall it.

you have to install.

ES7+ React/Redux/React-Native snippets

in visual studio. Hope it works

enter image description here

Comments

1
  1. Delete Corrupted Extension Folder

    Navigate to the extensions directory:

  • Windows: C:\Users<username>.vscode\extensions
  • Linux/macOS: ~/.vscode/extensions
    Delete the folder named dsznajder.es7-react-js-snippets-4.4.3
  1. Reinstall the Extension
  • Search for ES7+ React/Redux/React-Native snippets and install it.

Comments

0

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

2 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
0

I had to uninstall the snippet extension I had which was:

React-Native/React/Redux snippets for es6/es7 v2.0.6 by: EQuimper

and I used the extension: ES7 React/Redux/GraphQL/React-Native snippets v1.9.3 by: rodrigovallades

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

Launch Quick Open:

  • Linux: Ctrl+P
  • macOS: ⌘P
  • Windows: Ctrl+P

Paste the following command and press Enter:

ext install dsznajder.es7-react-js-snippets

Comments

0

My snippets worked as I thought they should once I fixed auto imports from this post by setting includePackageJsonAutoImports to always on. I used to have to type "-" before they would come up.

Visual Studio Code - Auto Imports / Quick Fix does not work

Comments

0

installing both worked for me:
enter image description here enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.