IOS Code Formatting Plugin Clang-format

Source: Internet
Author: User
Tags switch case

Reference: http://blog.csdn.net/zhangao0086/article/details/42872263

Recently, I took over the project of colleagues, found that the project after a lot of hands, each of the code format style and a little difference led to the code display is messy, Google, found that there is an iOS code format plug-in Clang-format, quite to the force.

Configure Clangformat

Although the Clangformat itself has some standardized code formatting schemes built in, it can be customized as well, and we've adopted a custom approach.

Specifically, create a ". Clang-format" file in the project directory or in the workspace directory

. Clang-format is just a configuration file that can be copied anywhere. You can copy it to the root of your project, or you can copy it to the root directory of all your projects.

Configuration parameters:

# base Style
Basedonstyle:llvm

# Indent Width
Indentwidth:4

# line wrapping for parentheses
Breakbeforebraces:attach

# support for one-line if
Allowshortifstatementsonasingleline:true

# switch Case Indentation
Indentcaselabels:true

# The indent width of the block for OC
Objcblockindentwidth:4

# for OC, add a space after the attribute name
Objcspaceafterproperty:true

# The length of each line of characters
columnlimit:0

# Justification of comments
Aligntrailingcomments:true

# Add a space after parentheses
Spaceaftercstylecast:true

# do not add spaces in parentheses
Spacesinparentheses:false

# do not add spaces in brackets
Spacesinsquarebrackets:false

IOS Code Formatting Plugin Clang-format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.