Visual Studio Code - Adjust import quotation setting

后端 未结 10 1066
广开言路
广开言路 2021-02-02 04:56

When working in TypeScript in Visual Studio Code, the import suggestion on a type (triggered by space + period) will generate an import using double quotes.

Our TypeScri

10条回答
  •  既然无缘
    2021-02-02 05:14

    As of VS Code 1.21.1 you need to edit

    /usr/share/code/resources/app/extensions/typescript-basics/snippets/typescript.json

    In Windows

    /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-basics/snippets/typescript.json.

    In Windows 10 (vscode version 1.30.* (user setup) later)

    *C:\Users\\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-basics\snippets\typescript.json

    In the 'Import external module' section of that file make the body array property to be the value "import { $0 } from '${1:module}';" The section will then look like this:

    "Import external module.": {
        "prefix": "import statement",
        "body": [
            "import { $0 } from '${1:module}';"
        ],
        "description": "Import external module."
    },
    

提交回复
热议问题