我希望我的 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/