google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37k stars 13.28k forks source link

Parser intellij-java-google-style.xml to .editorconfig file #437

Open pedrro opened 5 years ago

pedrro commented 5 years ago

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?

jacobq commented 4 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 🤞

spencercjh commented 3 years ago

@jacobq It is unavailable in CLion 2020.2 image image

:cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry:

jacobq commented 3 years ago

@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:

spencercjh commented 3 years ago

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.

robbie-cahill commented 1 year 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 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