VSCode not auto completing HTML

后端 未结 13 1888
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 19:32

I\'m having trouble with my new installed Visual Studio Code on Windows 7. On Mac the editor automatically closes html tags but on my Win7 not. I assume there must be some o

13条回答
  •  醉梦人生
    2020-12-07 20:21

    If you type

    div.class

    and then press TAB, VS code will automatically close the DIV tag with the given CLASS

    But I think you want to do this operation by pressing the ENTER key.

    In that case, go to your VS Code user setting & paste the following code:

    "emmet.includeLanguages": {
        "javascript": "javascriptreact",
        "vue-html": "html",
        "razor": "html",
        "plaintext": "jade"
    }
    

    Now if you type

    div.class

    & then press the ENTER key, you can see the magic.

    However, the above code will make your VS Code auto-completion with ENTER key not only for normal HTML but also the JSX of React, Vue.js snippets will also cover by this.

    But If you want to do it only for HTML file, just the following line is enough:

    "emmet.includeLanguages": { "javascript": "html" }
    

    Cheers..

提交回复
热议问题