gpt4 book ai didi

objective-c - uncrustify:摆脱 "comment after function of size"(mod_add_long_function_closebrace_comment)

转载 作者:行者123 更新时间:2023-12-02 05:00:59 24 4
gpt4 key购买 nike

我将“大小函数后的评论”设置为一个非常小的值来运行 uncrustify。现在几乎每个函数都有这样的注释:

-(void) createBackgroundGradient
{
...
} /* createBackgroundGradient */

我似乎找不到 的方法删除 这个尾随函数注释。将参数值更改为仅向大型函数添加注释不会删除较小函数的现有注释。

甚至可以使用 uncrustify 删除函数后注释吗?如果是这样,如果我想在所有项目文件中进行搜索和替换,(安全的)Xcode 正则表达式需要看起来像什么?

最佳答案

# If a function body exceeds the specified number of newlines and doesn't have a comment after
# the close brace, a comment will be added.

mod_add_long_function_closebrace_comment = 0

留着这个家伙 0 .

至于删除,您必须使用重构工具。我可以向你展示如何在 Vim 中做到这一点:
:%s/^\s*}\zs\s*\/\*.*\*\///g

一般来说,使用 classical (Perl) regular expression syntax ,我会做以下事情:
  • 搜索:(^\s*})\s*\/\*.*\*\/\s*
  • 替换:\1

  • 如果 XCode 正则表达式引擎支持捕获组(例如上面的 \1),那么它应该可以正常工作。

    关于objective-c - uncrustify:摆脱 "comment after function of size"(mod_add_long_function_closebrace_comment),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16262992/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com