iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
xi_lin
V2EX  ›  iDev

使用 Clang-Format 时的字符串截断问题

  •  
  •   xi_lin · Jul 5, 2015 · 5479 views
    This topic created in 4140 days ago, the information mentioned may be changed or developed.

    我的配置如下:

    BasedOnStyle: LLVM
    IndentWidth: 4
    AllowShortIfStatementsOnASingleLine: true
    ColumnLimit: 120

    现在的问题时长字符串总是会被分割成多行。试着加大PenaltyBreakString的值也没有用。

    大家有类似的设置不?

    16 replies  •  2015-07-06 16:40:41 +08:00
    Monad
    Monad
    Jul 5, 2015 via iPhone
    1
    感谢楼主让我知道了这么个工具
    另外楼主用过astyle吗?如果用过对比感觉如何?
    cplus
    cplus
    Jul 5, 2015❤️1
    2
    ColumnLimit: 120 一行120个字符,是超过这个限制才被分成多行了吧?
    BreakTheBank
    BreakTheBank
    Jul 5, 2015
    3
    2楼是对的。设置成 ColumnLimit: 1000
    loveuqian
    loveuqian
    Jul 5, 2015 via iPhone
    4
    可以伸手求一份行首党的配置嘛
    BreakTheBank
    BreakTheBank
    Jul 5, 2015
    5
    @loveuqian 什么意思
    IanZeppelin
    IanZeppelin
    Jul 6, 2015
    6
    Lin指导威武~遇到了就水一个~
    proudzhu
    proudzhu
    Jul 6, 2015 via Android
    7
    @huoshanhui 函数括号在行首
    @loveuqian clang-format 的官方文档里有 kernel 风格的,行首党路过
    mozartgho
    mozartgho
    Jul 6, 2015
    8
    你们有人在windows上成功编译出clang的吗,用vs2013+cmake按照官方文档有很多错误
    xi_lin
    xi_lin
    OP
    Jul 6, 2015
    9
    @Monad 没有用过,你可以对比看看~
    xi_lin
    xi_lin
    OP
    Jul 6, 2015
    10
    @cplus 果然是这样!我还以为`PenaltyBreakString `会优先于`ColumnLimit`
    xi_lin
    xi_lin
    OP
    Jul 6, 2015
    11
    @huoshanhui 我直接把ColumnLimit设为0了
    xi_lin
    xi_lin
    OP
    Jul 6, 2015
    12
    @IanZeppelin 这都能遇到~
    forcecharlie
    forcecharlie
    Jul 6, 2015❤️1
    13
    @mozartgho 这个不成问题的,官方有提供预构建的,安装后,Visual Studio 可以使用 clang 来编译项目,当然需要设置好编译器参数. http://llvm.org/builds/ 也可以自己构建,使用 ClangSetupvNext (http://fstudio.github.io/clangbuilder/)可以自动下载和安装构建环境,https://sourceforge.net/projects/clangonwin/ 提供了一些预编译的包 不过没时间更新了。
    mozartgho
    mozartgho
    Jul 6, 2015
    14
    @forcecharlie 谢谢你提供的这些信息,我先看看
    BreakTheBank
    BreakTheBank
    Jul 6, 2015
    15
    @xi_lin 这个 clang-format 有个 Bug 就是设置 0 有时会失效。
    xi_lin
    xi_lin
    OP
    Jul 6, 2015
    16
    @huoshanhui 我还以为这是个feature,0的时候不限
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1384 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 20:18 · PVG 04:18 · LAX 12:18 · JFK 15:18
    ♥ Do have faith in what you're doing.