V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
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 · 2015-07-05 16:58:37 +08:00 · 4000 次点击
    这是一个创建于 3211 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我的配置如下:

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

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

    大家有类似的设置不?

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