在 WebStorm 中更改自动导入格式

Change auto import format in WebStorm

我正在使用 WebStorm 2016.3,目前正在处理基于 typescript 的项目。

现在自动导入会生成如下内容:

import {xxx} from "yyy"

我想将格式更改为

import { xxx } from 'yyy'

我该怎么做?

您可以在以下位置进行更改:

Settings | Code Style | Typescript | Other

Select 单引号 引号 生成的代码部分

2016.3.*:

  • Settings | Code Style | Typescript | Spaces中,启用Within / ES6 import/export braces

  • Settings | Code Style | Typescript | Other中,设置Quote marks:单引号

2017.1.*:

  • Settings | Code Style | Typescript | Spaces 中,启用 Within / ES6 import/export braces
  • Settings | Code Style | Typescript | Punctuation中,将Use设为