Open pedrro opened 5 years ago
If you have IntelliJ it looks like you can export configuration via "File->Settings->Editor->Code Style" (see https://stackoverflow.com/questions/35915970/how-to-export-all-my-intellij-code-styles-to-a-editorconfig-file)
I'm in the process of trying to get an .editorconfig
for the C++ style guide by using CLion to import eclipse-cpp-google-style.xml
and then export again 🤞
@jacobq It is unavailable in CLion 2020.2
:cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry:
@jacobq It is unavailable in CLion 2020.2
I can't remember if I even got it to work before or not (see https://github.com/google/styleguide/issues/411), but in any case support for importing from an Eclipse style file is an open issue filed a long time ago (please consider voting for it):
https://youtrack.jetbrains.com/issue/CPP-368
It would be nice if there were also a intellij-cpp-google-style.xml
file here, but my guess is that no one is assigned to this task nor has anyone cared enough to volunteer. I suppose one of us could start by taking the "Google" presets that CLion ships with then exporting the resulting XML and submitting a PR.
See also:
I just use Intellij IDEA to write protobuf files and need cpp code style. I think user shoud not write cpp by Intellj IDEA but use CLion with nice full supports.
I try to do something else to go around this issue and solve my problem of code format consistency.
.editorconfig
to simulate Google cpp code style on .proto
..clang-format
used by an Intellij IDEA plugin described below to config ClangFormat.sudo apt install clang-format
.clang-format
in the PATH
and .clang-format
config file in the root directory of project.Reformat Code with clang-format
to every file you edit. There is no default keymap of the command. You can bind one or just use Search Everywhere
, type clang
and get it in the Action
part.Reformat code
in the commit config from unexpected code formatting.git diff -U0 --no-color HEAD^ | clang-format-diff -style Google -i -p1
.I strongly suggest you execute both steps to ensure there is no diff about format. If you have IntelliJ it looks like you can export configuration via "File->Settings->Editor->Code Style" (see https://stackoverflow.com/questions/35915970/how-to-export-all-my-intellij-code-styles-to-a-editorconfig-file)
I'm in the process of trying to get an
.editorconfig
for the C++ style guide by using CLion to importeclipse-cpp-google-style.xml
and then export again crossed_fingers
While it works, it does generate a bunch of things that look like IntelliJ specific config which might not work with other editors
ij_continuation_indent_size = 4
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
Hi, I'd like to use an .editorconfig file with the same configuration of intellij-java-google-style.xml
I'd like to know if this .editorconfig configured with this style already exist, or if not, could we do this translation from xml to .editorconfig?