首页 > 解决方案 > 在 Intellij Idea 中禁用 java doc 自动格式化。2019

问题描述

我希望我的 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 选项,但不知何故发生了变化。似乎不起作用

标签: javaintellij-ideacoding-stylejavadoc

解决方案



推荐阅读