如何格式化花括号以自动格式化intellij [英] How to format curly braces for autoformat in intellij

查看:156
本文介绍了如何格式化花括号以自动格式化intellij的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我点击alt-cmd-l来自动格式化代码时,它都会从以下位置格式化我的导入和数组:

Whenever I hit alt-cmd-l to autoformat my code, it formats my imports and arrays from:

import { CommonModule } from '@angular/common';
let arr = [ myStringVar ]; // simple example, just go with it

import {CommonModule} from '@angular/common';
let arr = [myStringVar];

在自动格式化时,如何告诉IntelliJ在大括号后和大括号前放置一个空格? (专门用于javascript,打字稿)

How do I tell IntelliJ to put a space after the opening brace and before the close brace when auto-formatting? (Specifically for javascript, typescript)

我一直在寻找答案,却找不到一个答案或严重问了一个问题.因此,如果这是重复的话,我深表歉意.

I've looked around for the answer and could not find one or asked the question badly. So I apologize if this is duplicate.

我正在使用Intellij 2016.3.3

I'm on Intellij 2016.3.3

推荐答案

转到设置并搜索ES6导入/导出括号.它应该带您进入编辑器->代码样式-> Javascript(或TypeScript).只需点击空格"选项卡上的复选框,它应将空格重新添加.

Go to settings and search for ES6 import/export braces. It should take you to Editor -> Code Style -> Javascript (or TypeScript). Just hit that checkbox on the spaces tab and it should add the spaces back.

这篇关于如何格式化花括号以自动格式化intellij的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆