首页 > 解决方案 > ClangFormat 的 80 个字符限制适用于以 @ 开头但不是 \ 的注释

问题描述

我有一个.clang-format. ColumnLimit: '80'当我为以下函数编写 doxygen 块时,它们被整齐地包装在 80 个字符中:

    /**
     * @brief Writes out the 80-byte header (in binary STL) for the STL representation of some geometry.
     * @param[out] fileStream - The file to write the header to
     */

变成:

    /**
     * @brief Writes out the 80-byte header (in binary STL) for the STL
     * representation of some geometry.
     * @param[out] fileStream - The file to write the header to
     */

但是,如果我用它\而不是它做同样的事情,@如果它结束,它就不再自动换行:

    /**
     * \brief Writes out the 80-byte header (in binary STL) for the STL representation of some geometry.
     * \param[out] fileStream - The file to write the header to
     */

我应该注意到 a 之后的以下\,或者只是杂散的注释块可以正常工作。IE,如果我这样做

/**
 * Here is a really long comment that is greater than 80 characters, notice how it gets wrapped?
 */

它成为了:

/**
 * Here is a really long comment that is greater than 80 characters, notice
 * how it gets wrapped?
 */

为什么会这样?

Clang 版本:7.0.1

我的 IDE 是QTCreator,版本 4.7.2。我将其设置为在保存文件时重新格式化文件,这对所有事情都有效。(以 开头的注释行除外\

标签: qt-creatorclang-format

解决方案


推荐阅读