Skip to content

Commit

Permalink
Merge branch '1743-compile-gutter-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPirates committed Jan 12, 2021
2 parents ccefd73 + df59665 commit e1ed167
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/nl/hannahsten/texifyidea/gutter/LatexCompileGutter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.intellij.psi.PsiElement
import com.intellij.util.Function
import nl.hannahsten.texifyidea.TexifyIcons
import nl.hannahsten.texifyidea.psi.LatexBeginCommand
import nl.hannahsten.texifyidea.psi.LatexParameterText
import nl.hannahsten.texifyidea.psi.LatexTypes
import nl.hannahsten.texifyidea.util.isEntryPoint
import nl.hannahsten.texifyidea.util.parentOfType

Expand All @@ -19,14 +19,14 @@ import nl.hannahsten.texifyidea.util.parentOfType
class LatexCompileGutter : RunLineMarkerContributor() {

override fun getInfo(element: PsiElement): Info? {
if (element.firstChild != null || element.parent !is LatexParameterText) return null
// Only show the icon on lines with `\begin` => show only one icon.
if (element.node.elementType != LatexTypes.BEGIN_TOKEN) return null

// Find the total enclosed begin command: required to easily find the first command.
val beginCommand = element.parentOfType(LatexBeginCommand::class) ?: return null

// Break when not a valid command: don't show icon.
if (!beginCommand.isEntryPoint()) {
return null
}
if (beginCommand.isEntryPoint().not()) return null

// Lookup actions.
val actionManager = ActionManager.getInstance()
Expand All @@ -41,4 +41,4 @@ class LatexCompileGutter : RunLineMarkerContributor() {
editConfigs
)
}
}
}

0 comments on commit e1ed167

Please sign in to comment.