Add extension for kotlin collections support
This commit is contained in:
committed by
Yan Zhulanow
parent
871dc4253f
commit
ad1a91a6c8
+12
@@ -0,0 +1,12 @@
|
||||
package com.intellij.debugger.streams.kotlin.lib
|
||||
|
||||
import com.intellij.debugger.streams.lib.impl.LibrarySupportBase
|
||||
|
||||
/**
|
||||
* @author Vitaliy.Bibaev
|
||||
*/
|
||||
class KotlinCollectionLibrarySupport : LibrarySupportBase() {
|
||||
init {
|
||||
TODO("add supported operations")
|
||||
}
|
||||
}
|
||||
+14
-9
@@ -1,9 +1,13 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.debugger.streams.kotlin.lib
|
||||
|
||||
import com.intellij.debugger.streams.kotlin.psi.impl.KotlinCollectionChainBuilder
|
||||
import com.intellij.debugger.streams.kotlin.trace.dsl.KotlinStatementFactory
|
||||
import com.intellij.debugger.streams.kotlin.trace.impl.KotlinTraceExpressionBuilder
|
||||
import com.intellij.debugger.streams.lib.LibrarySupport
|
||||
import com.intellij.debugger.streams.lib.LibrarySupportProvider
|
||||
import com.intellij.debugger.streams.trace.TraceExpressionBuilder
|
||||
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
|
||||
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
@@ -11,17 +15,18 @@ import com.intellij.openapi.project.Project
|
||||
* @author Vitaliy.Bibaev
|
||||
*/
|
||||
class KotlinCollectionSupportProvider : LibrarySupportProvider {
|
||||
private companion object {
|
||||
val builder: StreamChainBuilder = KotlinCollectionChainBuilder()
|
||||
val support: LibrarySupport = KotlinCollectionLibrarySupport()
|
||||
val dsl = DslImpl(KotlinStatementFactory())
|
||||
}
|
||||
|
||||
override fun getLanguageId(): String = LibraryUtil.KOTLIN_LANGUAGE_ID
|
||||
|
||||
override fun getChainBuilder(): StreamChainBuilder {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
override fun getChainBuilder(): StreamChainBuilder = builder
|
||||
|
||||
override fun getLibrarySupport(): LibrarySupport {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
override fun getLibrarySupport(): LibrarySupport = support
|
||||
|
||||
override fun getExpressionBuilder(p0: Project): TraceExpressionBuilder {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
override fun getExpressionBuilder(project: Project): TraceExpressionBuilder
|
||||
= KotlinTraceExpressionBuilder(dsl, support.createHandlerFactory(dsl))
|
||||
}
|
||||
+26
-4
@@ -1,14 +1,36 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.debugger.streams.kotlin.psi.impl
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
||||
|
||||
/**
|
||||
* @author Vitaliy.Bibaev
|
||||
*/
|
||||
class KotlinCollectionChainBuilder : KotlinChainBuilderBase(TODO("transmit here a correct transformer")) {
|
||||
override val existenceChecker: ExistenceChecker
|
||||
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
|
||||
override val existenceChecker: ExistenceChecker = object : ExistenceChecker() {
|
||||
override fun visitCallExpression(expression: KtCallExpression) {
|
||||
if (isFound()) return
|
||||
if (isCollectionTransformationCall(expression)) {
|
||||
fireElementFound()
|
||||
} else {
|
||||
super.visitCallExpression(expression)
|
||||
}
|
||||
}
|
||||
|
||||
override fun createChainsBuilder(): ChainBuilder {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
private fun isCollectionTransformationCall(expression: KtCallExpression): Boolean {
|
||||
TODO("determine that expression is a collection transformation")
|
||||
}
|
||||
}
|
||||
|
||||
override fun createChainsBuilder(): ChainBuilder = object : ChainBuilder() {
|
||||
private val previousCalls: MutableMap<KtCallExpression, KtCallExpression> = mutableMapOf()
|
||||
|
||||
override fun visitCallExpression(expression: KtCallExpression) {
|
||||
super.visitCallExpression(expression)
|
||||
}
|
||||
|
||||
override fun chains(): List<List<KtCallExpression>> {
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user