简体   繁体   English

如何将IntelliJ / WebStorm配置为在* .TS,*。JS文件中的代码完成中使用单引号

[英]How to configure IntelliJ / WebStorm to use single quotes in code completion within *.TS, *.JS files

I work a lot with TypeScript files and JavaScript files using modules. 我使用模块处理TypeScript文件和JavaScript文件。

My TS/ESLint rules enforce the use of single quotes, but WebStorm always completes the code with double quotes. 我的TS / ESLint规则强制使用单引号,但是WebStorm始终使用双引号来完成代码。 Is there a way to configure this? 有没有一种配置方式?

Make sure to set up the desired code style in Settings | 确保在“设置” |“设置”设置所需的代码样式。 Editor | 编辑器 Code Style | 代码样式| TypeScript (and JavaScript ) - namely, set Use single quotes always in Punctuation tab. TypeScript (和JavaScript )-即,在“ 标点”选项卡中设置“ 始终使用单引号” Note that IDEA and WebStorm can import code style prerefences from tslint.json : open it in editor and click Yes when prompted to apply settings. 请注意,IDEA和WebStorm可以从tslint.json导入代码样式参考:在编辑器tslint.json打开,并在系统提示您应用设置时单击“ 是” See https://blog.jetbrains.com/webstorm/2017/01/webstorm-2017-1-eap-171-2455/ , Import code style from tslint.json 请参阅https://blog.jetbrains.com/webstorm/2017/01/webstorm-2017-1-eap-171-2455/从tslint.json导入代码样式

Same is true for .eslintrc - see https://blog.jetbrains.com/webstorm/2017/06/webstorm-2017-2-eap-172-3198/ .eslintrc也是如此-请参阅https://blog.jetbrains.com/webstorm/2017/06/webstorm-2017-2-eap-172-3198/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM