0

I've a CLion project that uses a code style defined by means of clang format. That code style is defined by someone else and it's completely opposite with respect to mine. Is it possible to have a local view of the code that makes the code to be formatted in the IDE according to my preferences, while keeping the original source files with the already provided style?

In other words:

  • Repository has code style A (with respective .clang-format file)
  • I clone the repoitory and I would like to see it inside the IDE with code style B
  • I write my code with code style B
  • I commit the code, and the new files (or the edited ones) on the repository still have code style A, despite being edited with code style B
  • 1
    I don't think so. clang-format doesn't change what the IDE shows you, it changes the underlying source file. You would have to run clang-format on all repository files to convert to your style, then use your IDE, then run clang-format again to change all repository files back to their original style, then commit. Sounds error-prone to me... – Eric Backus Oct 14 '20 at 17:27
  • Yeah pretty annoying and error-prone. That is why I was searching for a "view-only" method that doesn't change the real sources – Michele Scuttari Oct 14 '20 at 17:33
  • https://stackoverflow.com/a/75571466/7976758 , https://stackoverflow.com/a/59347118/7976758 – phd Feb 26 '23 at 13:16

0 Answers0