Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding debug hover #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions kotlin-eclipse-ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,10 @@
</extension>
<extension
point="org.jetbrains.kotlin.ui.editor.textHover">
<hover
class="org.jetbrains.kotlin.ui.editors.hover.KotlinDebugHover"
name="Hover showing debugged variable info">
</hover>
<hover
class="org.jetbrains.kotlin.ui.editors.hover.KotlinJavadocTextHover"
name="Hover showing details of Kotlin element">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.jetbrains.kotlin.ui.editors.hover

import org.eclipse.jdt.internal.debug.core.model.JDILocalVariable
import org.eclipse.jdt.internal.debug.ui.ExpressionInformationControlCreator
import org.eclipse.jdt.internal.debug.ui.JavaDebugHover
import org.eclipse.jface.text.IInformationControlCreator
import org.jetbrains.kotlin.ui.editors.KotlinEditor

class KotlinDebugHover(): JavaDebugHover(), KotlinEditorTextHover<JDILocalVariable?> {

override val hoverPriority: Int
get() = 1

private val fHoverControlCreator: IInformationControlCreator by lazy {
ExpressionInformationControlCreator()
}

override fun isAvailable(hoverData: HoverData): Boolean = true

override fun getHoverControlCreator(editor: KotlinEditor): IInformationControlCreator? = fHoverControlCreator

override fun getHoverControlCreator(): IInformationControlCreator = fHoverControlCreator

override fun getHoverInfo(hoverData: HoverData): JDILocalVariable? =
getHoverInfo2(hoverData.editor.javaEditor.viewer, hoverData.getRegion()) as? JDILocalVariable

}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class KotlinJavadocTextHover : KotlinEditorTextHover<BrowserInformationControlIn
}

override val hoverPriority: Int
get() = 2
get() = 3

override fun getHoverControlCreator(): IInformationControlCreator = fHoverControlCreator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.jetbrains.kotlin.ui.editors.toCompletionProposals
class KotlinProblemTextHover: ProblemHover(), KotlinEditorTextHover<Any> {

override val hoverPriority: Int
get() = 1
get() = 2

override fun getHoverInfo(hoverData: HoverData): Any? =
hoverData.getRegion()?.let { region ->
Expand Down