Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
*/
internal fun findFirstKtElementInParents(file: KtFile, offset: Int, line: String): PsiElement? {
return file.elementsInRange(TextRange.create(offset - line.length, offset))
.mapNotNull { it.getNonStrictParentOfType<KtElement>() }
.plus(file.findElementAt(offset))
.mapNotNull { it?.getNonStrictParentOfType() }
.firstOrNull()
}
11 changes: 11 additions & 0 deletions detekt-rules-style/src/test/resources/MaxLineLengthSuppressed.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ class MaxLineLengthSuppressed {

@Suppress("MaxLineLength")
class AClassWithSuperLongNameItIsSooooLongThatIHaveTroubleThinkingAboutAVeryLongNameManThisIsReallyHardToFillAllTheNecessaryCharacters

@Suppress("MaxLineLength")
class AClassWithReallyLongCommentsInside {
/*
a really long line that is inside a normal comment ------------------------------------------------------------------------------------------------>
*/

/**
a really long line that is inside a KDoc comment ------------------------------------------------------------------------------------------------>
*/
}