diff --git a/annotations/com/intellij/psi/annotations.xml b/annotations/com/intellij/psi/annotations.xml
index b5f752134d5..6312afc8d2a 100644
--- a/annotations/com/intellij/psi/annotations.xml
+++ b/annotations/com/intellij/psi/annotations.xml
@@ -17,6 +17,9 @@
-
+ -
+
+
-
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 6a5db683de9..57675a34fce 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -309,6 +309,8 @@
implementationClass="org.jetbrains.jet.plugin.refactoring.safeDelete.KotlinJavaSafeDeleteDelegate"/>
+
+
diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/KotlinEditorTextProvider.kt b/idea/src/org/jetbrains/jet/plugin/debugger/KotlinEditorTextProvider.kt
new file mode 100644
index 00000000000..62a00c6d5e5
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/debugger/KotlinEditorTextProvider.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.debugger
+
+import com.intellij.debugger.impl.EditorTextProvider
+import com.intellij.psi.PsiElement
+import com.intellij.debugger.engine.evaluation.TextWithImports
+import com.intellij.openapi.util.TextRange
+import com.intellij.openapi.util.Pair
+import com.intellij.debugger.engine.evaluation.TextWithImportsImpl
+import com.intellij.debugger.engine.evaluation.CodeFragmentKind
+
+class KotlinEditorTextProvider : EditorTextProvider {
+ override fun getEditorText(elementAtCaret: PsiElement): TextWithImports? {
+ return TextWithImportsImpl(CodeFragmentKind.EXPRESSION, elementAtCaret.getText())
+ }
+
+ override fun findExpression(elementAtCaret: PsiElement, allowMethodCalls: Boolean): Pair? {
+ return Pair(elementAtCaret, elementAtCaret.getTextRange())
+ }
+}
+
diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinCodeFragmentFactory.kt b/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinCodeFragmentFactory.kt
new file mode 100644
index 00000000000..229fd9a513b
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinCodeFragmentFactory.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2010-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.debugger.evaluate
+
+import com.intellij.debugger.engine.evaluation.CodeFragmentFactory
+import com.intellij.debugger.engine.evaluation.TextWithImports
+import com.intellij.psi.PsiElement
+import com.intellij.openapi.project.Project
+import com.intellij.psi.JavaCodeFragment
+import com.intellij.openapi.fileTypes.LanguageFileType
+import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilder
+import org.jetbrains.jet.plugin.JetFileType
+import org.jetbrains.jet.lang.psi.JetCodeFragmentImpl
+import com.intellij.psi.tree.IElementType
+import org.jetbrains.jet.lexer.JetToken
+import org.jetbrains.jet.JetNodeType
+import org.jetbrains.jet.lexer.JetTokens
+import org.jetbrains.jet.lang.psi.JetExpressionCodeFragmentImpl
+
+class KotlinCodeFragmentFactory: CodeFragmentFactory() {
+ override fun createCodeFragment(item: TextWithImports, context: PsiElement?, project: Project): JavaCodeFragment {
+ return JetExpressionCodeFragmentImpl(project, "fragment.kt", item.getText(), context)
+ }
+
+ override fun createPresentationCodeFragment(item: TextWithImports, context: PsiElement?, project: Project): JavaCodeFragment {
+ return createCodeFragment(item, context, project)
+ }
+
+ override fun isContextAccepted(contextElement: PsiElement?): Boolean {
+ return contextElement?.getLanguage() == JetFileType.INSTANCE.getLanguage()
+ }
+
+ override fun getFileType() = JetFileType.INSTANCE
+
+ override fun getEvaluatorBuilder() = null
+}