Skip to content

Commit

Permalink
Fixed line marker performance warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kizeevov committed Dec 16, 2023
1 parent 6c1fc9d commit 82d6806
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Fixed
- Fixed linear marker preview
- Fixed line marker performance warning

## [0.2.7] - 2023-11-15

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@ import dev.slint.ideaplugin.lang.psi.SlintElementTypes.*
class PreviewRunLineMarkerContributor : RunLineMarkerContributor() {
override fun getInfo(element: PsiElement): Info? {
return when (element.elementType) {
COMPONENT_DEFINITION -> {
val componentName = getComponentName(element) ?: return null
Info(PreviewComponentAction(componentName))
COMPONENT -> {
Info(PreviewComponentAction(""))
}

else -> {
null
}
}
}

private fun getComponentName(element: PsiElement): String? {
val componentName = element.children.firstOrNull() ?: return null
if (componentName.elementType != COMPONENT_NAME) {
return null
}
return componentName.text
}
}

0 comments on commit 82d6806

Please sign in to comment.