Skip to content

Specify ContinuationIndentWidth as 2*IndentWidth#121

Open
tejasvi wants to merge 2 commits into
rhysd:masterfrom
tejasvi:patch-1
Open

Specify ContinuationIndentWidth as 2*IndentWidth#121
tejasvi wants to merge 2 commits into
rhysd:masterfrom
tejasvi:patch-1

Conversation

@tejasvi

@tejasvi tejasvi commented Jan 26, 2022

Copy link
Copy Markdown

Most styles use ContinuationIndentWidth = 2*IndentWidth (google, llvm, etc). With existing arguments, shiftwidth=4 gives

constexpr operator To() const
    noexcept(noexcept(static_cast≺To≻(ːdeclval≺From≻()))) ⇉
    return static_cast≺To≻(val)

instead of expected

constexpr operator To() const
        noexcept(noexcept(static_cast≺To≻(ːdeclval≺From≻()))) ⇉
    return static_cast≺To≻(val)

Most styles use ContinuationIndentWidth = 2*IndentWidth (google, llvm, etc). With existing arguments, shiftwidth=4 gives
```cpp
constexpr operator To() const
    noexcept(noexcept(static_cast≺To≻(ːdeclval≺From≻()))) ⇉
    return static_cast≺To≻(val)
```
instead of expected
```cpp
constexpr operator To() const
        noexcept(noexcept(static_cast≺To≻(ːdeclval≺From≻()))) ⇉
    return static_cast≺To≻(val)
```
@rhysd

rhysd commented Feb 3, 2022

Copy link
Copy Markdown
Owner

I think it should be set with g:clang_format#style_options rather than setting it always. How about the following configuration?

let g:clang_format#style_options = {
            \ 'ContinuationIndentWidth' : '8',
            \ }

@tejasvi

tejasvi commented Feb 4, 2022

Copy link
Copy Markdown
Author

It would work, but I'd like to propose better defaults and OOTB experience. Currently behavior deviates from the expected indentation for g:clang_format#code_style since it overrides IndentWidth but not ContinuationIndentWidth. Feel free to close this one, I am fine either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants