admin管理员组

文章数量:1188999

I'm using VS Code to code a React project. When I'm typing my HTML tags, the suggestion box pops up and correctly suggests that I'm typing a <div> tag, for exmpale. However, hitting Tab key or Enter key do nothing. Not even using my mouse to click on the autosuggest does anything. I've looked it up and adjusted my user settings with no success. In the bottom right corner, I changed it from JavaScript to JavaScript React". I added these to my settings:

{
  "emmet.includeLanguages": {
        "javascript": "javascriptreact",
        "javascript": "html"
    },
    "emmet.triggerExpansionOnTab": true,
}


These didn't really do anything different. What can do I? It's annoying enough that I'm thiking of going back to Atom. Having to not only type each tag seperately but then having to position the closing tag afterwards is destroying any productivity.

I'm using VS Code to code a React project. When I'm typing my HTML tags, the suggestion box pops up and correctly suggests that I'm typing a <div> tag, for exmpale. However, hitting Tab key or Enter key do nothing. Not even using my mouse to click on the autosuggest does anything. I've looked it up and adjusted my user settings with no success. In the bottom right corner, I changed it from JavaScript to JavaScript React". I added these to my settings:

{
  "emmet.includeLanguages": {
        "javascript": "javascriptreact",
        "javascript": "html"
    },
    "emmet.triggerExpansionOnTab": true,
}


These didn't really do anything different. What can do I? It's annoying enough that I'm thiking of going back to Atom. Having to not only type each tag seperately but then having to position the closing tag afterwards is destroying any productivity.

Share Improve this question asked May 24, 2018 at 18:12 A. CamA. Cam 1492 silver badges10 bronze badges
Add a comment  | 

4 Answers 4

Reset to default 24

Try the following steps:

  1. From the bottom right click on Language Mode (which might be showing html)
  2. In the search section (at the top) of the box that pops up, search for "react".
  3. Two React options might appear: javascript react and typescript react.
  4. Choose the "Javascript React".

Try adding this to your settings:

 "files.associations": {
    "*.js": "javascriptreact"
  }

click on the setting -> click on the (open JSON setting) at the top right of vs code then paste this line of code "emmet.includeLanguages": {"javascript": "javascriptreact"},

  1. Go to settings
  2. Search For "emmet"
  3. Find Emmet: Include Languages
  4. Add Item: "javascript": "javascriptreact"

本文标签: javascriptAutocomplete of HTML tags in React aren39t working in VS CodeStack Overflow