@@ -25,7 +25,7 @@ abstract class CommentFunctionAction : AnAction() {
2525 val psiFile = e.getData(CommonDataKeys .PSI_FILE )
2626
2727 val isEnabled = editor != null && psiFile != null &&
28- (findEnclosingFunction(psiFile, editor) != null || findCommentedFunction(psiFile, editor) != null )
28+ (findEnclosingFunction(psiFile, editor) != null || findCommentedFunction(psiFile, editor) != null )
2929 e.presentation.isEnabledAndVisible = isEnabled
3030 }
3131
@@ -57,9 +57,11 @@ abstract class CommentFunctionAction : AnAction() {
5757 val endLine = document.getLineNumber(commentedFunction.endOffset)
5858 uncommentSingleLine(document, startLine, endLine)
5959 }
60+
6061 CommentStyle .MULTI_LINE -> {
6162 uncommentMultiLine(document, commentedFunction.startOffset, functionText)
6263 }
64+
6365 CommentStyle .NONE -> {}
6466 }
6567 }
@@ -90,7 +92,10 @@ abstract class CommentFunctionAction : AnAction() {
9092
9193 if (elementAtCaret != null ) {
9294 val blockComment = PsiTreeUtil .getParentOfType(elementAtCaret, PsiComment ::class .java, false )
93- if (blockComment != null && blockComment.text.trimStart().startsWith(" /*" ) && containsFunctionPattern(blockComment.text)) {
95+ if (blockComment != null && blockComment.text.trimStart().startsWith(" /*" ) && containsFunctionPattern(
96+ blockComment.text
97+ )
98+ ) {
9499 return CommentedFunctionInfo (
95100 startOffset = blockComment.textRange.startOffset,
96101 endOffset = blockComment.textRange.endOffset,
@@ -155,7 +160,8 @@ abstract class CommentFunctionAction : AnAction() {
155160 }
156161
157162 val functionKeywords = mutableListOf<Int >()
158- val functionPattern = Regex (" ^\\ s*(public|private|protected|static|final|abstract|\\ s)*\\ s*function\\ s+\\ w+\\ s*\\ (" )
163+ val functionPattern =
164+ Regex (" ^\\ s*(public|private|protected|static|final|abstract|\\ s)*\\ s*function\\ s+\\ w+\\ s*\\ (" )
159165
160166 for ((lineNum, content) in lines) {
161167 if (functionPattern.containsMatchIn(content) || content.trim().startsWith(" function " )) {
@@ -207,6 +213,7 @@ abstract class CommentFunctionAction : AnAction() {
207213 braceDepth++
208214 foundOpenBrace = true
209215 }
216+
210217 ' }' -> {
211218 braceDepth--
212219 if (foundOpenBrace && braceDepth == 0 ) {
@@ -235,7 +242,7 @@ abstract class CommentFunctionAction : AnAction() {
235242 .trim()
236243
237244 return cleanedText.contains(Regex (" function\\ s+\\ w+\\ s*\\ (" )) ||
238- cleanedText.contains(Regex (" (public|private|protected|static)\\ s+(static\\ s+)?function\\ s+" ))
245+ cleanedText.contains(Regex (" (public|private|protected|static)\\ s+(static\\ s+)?function\\ s+" ))
239246 }
240247
241248 protected fun getFunctionTextRange (function : PsiElement , document : Document ): Pair <Int , Int > {
0 commit comments