java - 在 Intellij Idea 中禁用 java doc 自动格式化。 2019年

标签 java intellij-idea coding-style javadoc

我希望我的 javadoc 看起来像这样:

/**
* Date 10/01/2019
*
* Given a directed graph, find all strongly connected components in this graph.
* We are going to use Kosaraju's algorithm to find strongly connected       component.
*
* Algorithm
* Create a order of vertices by finish time in decreasing order.
* Reverse the graph
* Do a DFS on reverse graph by finish time of vertex and created strongly connected
* components.
*
* Runtime complexity - O(V + E)
* Space complexity - O(V)
*
* References
* https://en.wikipedia.org/wiki/Strongly_connected_component
* http://www.geeksforgeeks.org/strongly-connected-components/
*/

但不幸的是我的 javadoc 被自动格式化为:

/**
* Given a directed acyclic graph, find all connected components in the graph.       We will be using
* Kosaraju’s algorithm for finding all connected components
*
* <p>Algorithm :
*
* <p>Do DFS on the graph, mark the adjacent vertices as visited and order the visited vertex
*
* <p>Reverse the graph - transpose<>
*
* <p>Do DFS on the reversed graph, by pop- ing elements from the stack and marking them as visited
*
* <p>Complexity:
*
* <p>Runtime - O(V+E) for DFS
*
* <p>Space = O(V) for the stack and visited vertices
*
* <p>Date : 15/02/20
*
*
* <p>Referances : https://www.youtube.com/watch?v=RpgcYiky7uw
* https://www.geeksforgeeks.org/strongly-connected-components/
*/

如果我手动添加换行符并开始在下一行写入,则在代码格式期间,两行将合并为一行。我可以在下一行写入的唯一方法是添加两个换行符,因此在代码格式 ide 期间将

添加到新行

假设我想拆分

“对图进行DFS,将相邻顶点标记为已访问,并对已访问的顶点进行排序”

分成两行,但是一旦我重新格式化代码,这两行就会合并为一次

我正在使用 google-java-format 进行代码格式化。

我尝试修改代码样式 -> Java -> JavaDoc 选项,但不知何故发生了变化。似乎不起作用

最佳答案

为了避免 JavaDoc 中的行合并,您可以打开(首选项 | 编辑器 | 代码样式 | Java | JavaDoc)并取消标记“在右边距换行” 复选框。

关于java - 在 Intellij Idea 中禁用 java doc 自动格式化。 2019年,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60243165/

相关文章:

C++ 代码命名风格转换器、格式化程序或美化程序

java - 在 HttpSession 中 session = request.getSession(); "request"对象在哪里定义的?

java - 为什么会有Full GC?

java - Android 用户界面 : activity_main. xml 和 content_main.xml

intellij-idea - 在IntelliJ IDEA中,如何隐藏文本编辑器左侧的栏?

java - 使用 String.format 而不是连接的 toString 方法的 IntelliJ Idea 模板

c# - 在哪里存储应用程序全局设置?

java - 如何以更 "elegant"的方式重写这行代码?

java - 如何更改 IntelliJ 上的 Kotlin 编译器版本?

c# - 什么是 C# 静态字段命名约定?