VS Code Auto Indent / Code Formatting changes single quotation marks to double

后端 未结 2 1580
暗喜
暗喜 2021-01-03 20:01

I am using VS Code 1.17.2 with the following extensions installed (Unfortuanetly i can\'t link them since i don\'t have enough reputation):

  • Angular 5 Snippets
相关标签:
2条回答
  • 2021-01-03 20:54

    Daniel B's solution didnt help my case, I needed to follow this: https://github.com/praveenpuglia/angular-sanity/issues/4

    VSCode

    Auto imports are intelligent in VSCode to use tslint.json file in order to insert import statements based on your configuration. But if you are manually writing import statement and accidentally mess that up here's one thing to rescue.

    In User Preferences set the following:

    "tslint.autoFixOnSave": true
    


    Edit: one more thing, I noticed after testing that my issue seemed to boil down to the formatter. I updated my typescript formatter to this:

    "[typescript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    }
    

    after I updated the formatter that - I believe - helped fix the part that was incorrectly updating my code to double quotes

    0 讨论(0)
  • 2021-01-03 20:57

    The extensions uses the settings that are set in your VS Code user settings file.

    To change it, open your user settings file

    Ctrl+Shift+P and type Open User Settings.

    Search for prettier.singleQuote and change it to true like

    "prettier.singleQuote": true

    0 讨论(0)
提交回复
热议问题