llvm / llvm/llvm-project

clang-format -lines modifies code outside the specified range

Open
#166,121 1 comment 0 reactions 0 assignees View on GitHub
clang-format
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

When using an editor with “format on paste” enabled via clang-format, pasting an incomplete line, like in the example below, causes the following line to be indented, even if -lines is set to target only the pasted line. Pasting a partial line while using format-on-paste to adjust its indentation is a fairly reasonable workflow in my opinion, so it would be nice to either "fix" this behaviour or add a clang-format option to disable it.

```
QWindow* // pasted line

class RhiResourceManager
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.