如何从IDE外部导入代码风格方案到IntelliJ?

huangapple go评论85阅读模式
英文:

How to import code style scheme on Intellij from outside the IDE

问题

如果我想要在我的Java代码风格中添加一个全局方案,我需要进行以下操作:

  1. 设置 -> 代码风格 -> Java
  2. 我点击引擎图标 -> 导入方案
  3. 然后我选择一些包含我想要使用的代码风格的XML文件

我的想法是通过创建一个自动化流程来实现这个过程,我会安装IntelliJ并以编程方式将代码格式设置添加到全新安装中。

我找到了一些相关的内容,可以通过运行命令“idea format”来应用格式,但那不是我想要的。我想要像通常那样通过遵循我之前描述的3个步骤来全局设置代码风格。

英文:

If I want to add a global scheme to my Java code style I need to go to:

  1. Settings -> Code Style -> Java
  2. I click into the engine Icon -> Import Scheme
  3. And I select some XML with the code style that I want to use

My idea is to automate this process, by creating some playbook where I install intellij and programmatically add the formatter to the fresh installation.

I found some stuff related to applying the format by running the command "idea format", but that's not what I want. I want to set the code style globally as I usually do by following the 3 step I've described previously.

答案1

得分: 2

在Ubuntu下寻找IDE全局设置会导向 ~/.IntelliJIdea2019.3/config/ 文件夹。
其中包含各种IDE文件,其中 codestylesjba_config/codestyles(根据 高级配置 - 帮助 | IntelliJ IDEA,如果您使用 IDE设置同步,则会存在后者)。

然后,您应该能够直接从文件系统中替换 Default.xml 配置。

英文:

Looking for IDE global settings under Ubuntu led me to ~/.IntelliJIdea2019.3/config/ folder.
It contains various IDE files, among which codestyles and jba_config/codestyles (according to Advanced configuration - Help | IntelliJ IDEA, the latter exists if you are using IDE settings sync).

You should then be able to simply replace the Default.xml configuration directly from within file system.

huangapple
  • 本文由 发表于 2020年10月12日 12:40:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/64311777.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定