<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60917>60917</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Feature request: choose style (file) from within text files for IDEs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bersbersbers
</td>
</tr>
</table>
<pre>
As far as I have observed (and understand the documentation), using `clang-format` inside an IDE (e.g., Visual Studio) means that for each file, the closest `.clang-format` file is used, so one may end up getting different formatting styles for source code files in different directories. This is a great feature!
Now, is there *any* way of having different styles for files in the *same* directory? I haven't found one, which is why I am opening this feature request. (And I hope I am wrong, so that someone can close this issue and tell me where to find this in the documentation.) What I would like, for example, is one of the following:
- Being able to point `clang-format` to the name of a style file from within the source-code file
(`// clang-format Style: bers.clang_format` or similar)
- Being able to change individual style options from within each source-code file
(`// clang-format BinPackParameters: false` or similar)
- Being able to put a mapping file into a directory that says something like
```
file1.cpp: bers.clang-format
```
- Anything that achieves a similar effect.
The aim of this exercise, and the benefit of such as feature, is for multiple developers working on files in the same folder to use slightly varying style options for their own files while still being able to correctly format other files in the same directory. This is already possible across directories, and it would be a great addition inside a directory.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVc2O4zYTfBr60hhDpvwzPvjg_WYNzOXDArtIjkGbbEnMUqTCpqzV2wct2R47mEMCzNiGIHZVd1UXkdnVgeigNl_U5m2BfW5iOpwp8e1_cY52PBwZKkyADO_Q4IUgnpnShSwo_YrBQh8sJc7yMzcENpq-pZAxuxiU3iv9P-jZhRrUtjAeQ_1SxdRiVtsCXGBnCTDA-9tXKUjLeiknfnPco4fvubcuKr2HljAw5AYzVDEBoWmgcp7kZYE1PjJxFpDlP1HkPXAMPZOV9zlCDAQtjkDSQAc15SwUrasqShQmkBbnh5xHTzzBcuyTITDR0lSVwYWHQ9YlMjkmR7yE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