Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdfmt: support for --offset and --length #261

Open
JohanEngelen opened this issue May 6, 2023 · 1 comment
Open

sdfmt: support for --offset and --length #261

JohanEngelen opened this issue May 6, 2023 · 1 comment

Comments

@JohanEngelen
Copy link
Contributor

clang-format supports only reformatting part of a file, by specifying --offset and --length pairs on the commandline (see https://clang.llvm.org/docs/ClangFormat.html). I use this in my editor by selecting a few lines, and then only reformatting the selected lines, rather than the whole file. Very useful for not combining code changes (with correct formatting) with formatting fixes in other parts of the file.

@deadalnix
Copy link
Contributor

Just like #262 I don't have the bandwidth to make this happen but would assist. I think the right path forward here would be to leverage the skipFormat feature (triggered by sdfmt on/off style comments) to tell sdfmt to not format anythign outside of the the range. This is however likely to surface bug in that feature, which is not well tested at this time.

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

No branches or pull requests

2 participants