Add snippet result type to analysis output of REPL IDE services
This commit is contained in:
committed by
Ilya Chernikov
parent
c496b93218
commit
8a1b44cc2b
@@ -5,16 +5,13 @@
|
||||
|
||||
package kotlin.script.experimental.api
|
||||
|
||||
import kotlin.script.experimental.util.PropertiesCollection
|
||||
|
||||
/**
|
||||
* Type for [ReplCompleter.complete] return value
|
||||
*/
|
||||
typealias ReplCompletionResult = Sequence<SourceCodeCompletionVariant>
|
||||
|
||||
/**
|
||||
* Type for [ReplCodeAnalyzer.analyze] return value
|
||||
*/
|
||||
typealias ReplAnalyzerResult = Sequence<ScriptDiagnostic>
|
||||
|
||||
/**
|
||||
* Single code completion result
|
||||
*/
|
||||
@@ -25,6 +22,33 @@ data class SourceCodeCompletionVariant(
|
||||
val icon: String
|
||||
)
|
||||
|
||||
interface ReplAnalyzerResultKeys
|
||||
|
||||
/**
|
||||
* The container for analysis results data returned from the [ReplCodeAnalyzer.analyze]
|
||||
*/
|
||||
class ReplAnalyzerResult(baseConfigurations: Iterable<ReplAnalyzerResult>, body: Builder.() -> Unit = {}) :
|
||||
PropertiesCollection(Builder(baseConfigurations).apply(body).data) {
|
||||
|
||||
constructor(body: Builder.() -> Unit = {}) : this(emptyList(), body)
|
||||
|
||||
class Builder internal constructor(baseConfigurations: Iterable<ReplAnalyzerResult>) :
|
||||
ReplAnalyzerResultKeys,
|
||||
PropertiesCollection.Builder(baseConfigurations)
|
||||
|
||||
companion object : ReplAnalyzerResultKeys
|
||||
}
|
||||
|
||||
/**
|
||||
* Script compile-time errors and warning with their locations
|
||||
*/
|
||||
val ReplAnalyzerResultKeys.analysisDiagnostics by PropertiesCollection.key<Sequence<ScriptDiagnostic>>(emptySequence())
|
||||
|
||||
/**
|
||||
* String representing snippet return value, or null, if script returns nothing
|
||||
*/
|
||||
val ReplAnalyzerResultKeys.renderedResultType by PropertiesCollection.key<String?>()
|
||||
|
||||
/**
|
||||
* Interface for REPL context completion
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user