KT-17074: Make completion respect DslMarker's
#KT-17074 fixed
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
@DslMarker
|
||||
annotation class SimpleDsl
|
||||
|
||||
@SimpleDsl
|
||||
class DslRoot {
|
||||
fun container(body: DslContainer.() -> Unit) {
|
||||
body(DslContainer())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslContainer {
|
||||
fun child(body: DslChild.() -> Unit) {
|
||||
body(DslChild())
|
||||
}
|
||||
|
||||
fun otherChild(body: DslOtherChild.() -> Unit) {
|
||||
body(DslOtherChild())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslChild {
|
||||
operator fun String.unaryMinus() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
@DslMarker
|
||||
annotation class SimpleOtherDsl
|
||||
|
||||
@SimpleOtherDsl
|
||||
class DslOtherChild {
|
||||
fun otherThing() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun dsl(body: DslRoot.() -> Unit) {
|
||||
body(DslRoot())
|
||||
}
|
||||
|
||||
fun test() {
|
||||
dsl {
|
||||
container {
|
||||
child {
|
||||
-"Some"
|
||||
|
||||
}
|
||||
otherChild {
|
||||
otherThing()
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: {"lookupString":"otherThing", "attributes": ["bold"]}
|
||||
// EXIST: {"lookupString":"child", "attributes": ["bold"]}
|
||||
// EXIST: {"lookupString":"otherChild", "attributes": ["bold"]}
|
||||
@@ -0,0 +1,47 @@
|
||||
@DslMarker
|
||||
annotation class SimpleDsl
|
||||
|
||||
class DslRoot {
|
||||
|
||||
}
|
||||
|
||||
interface DslContainer
|
||||
|
||||
@SimpleDsl
|
||||
class DslContainerOne : DslContainer {
|
||||
fun DslContainer.one() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslContainerTwo : DslContainer {
|
||||
fun DslContainer.two() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun DslRoot.containerOne(body: DslContainerOne.() -> Unit) {
|
||||
body(DslContainerOne())
|
||||
}
|
||||
|
||||
fun DslRoot.containerTwo(body: DslContainerTwo.() -> Unit) {
|
||||
body(DslContainerTwo())
|
||||
}
|
||||
|
||||
fun dsl(body: DslRoot.() -> Unit) {
|
||||
body(DslRoot())
|
||||
}
|
||||
|
||||
fun test() {
|
||||
dsl {
|
||||
containerOne {
|
||||
containerTwo {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: {"lookupString":"two", "attributes":""}
|
||||
// EXIST: {"lookupString":"one", "attributes":["grayed"]}
|
||||
@@ -0,0 +1,41 @@
|
||||
@DslMarker
|
||||
annotation class SimpleDsl
|
||||
|
||||
@SimpleDsl
|
||||
class DslRoot {
|
||||
fun container(body: DslContainer.() -> Unit) {
|
||||
body(DslContainer())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslContainer {
|
||||
fun child(body: DslChild.() -> Unit) {
|
||||
body(DslChild())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslChild {
|
||||
operator fun String.unaryMinus() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun dsl(body: DslRoot.() -> Unit) {
|
||||
body(DslRoot())
|
||||
}
|
||||
|
||||
fun test() {
|
||||
dsl {
|
||||
container {
|
||||
child {
|
||||
-"Some"
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: {"lookupString":"container", "attributes":["grayed"]}
|
||||
// EXIST: {"lookupString":"child", "attributes":["grayed"]}
|
||||
@@ -0,0 +1,71 @@
|
||||
@DslMarker
|
||||
annotation class SimpleDsl
|
||||
|
||||
@SimpleDsl
|
||||
class DslRoot {
|
||||
fun container(body: DslContainer.() -> Unit) {
|
||||
body(DslContainer())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslContainer {
|
||||
fun child(body: DslChild.() -> Unit) {
|
||||
body(DslChild())
|
||||
}
|
||||
|
||||
fun otherChild(body: DslOtherChild.() -> Unit) {
|
||||
body(DslOtherChild())
|
||||
}
|
||||
|
||||
fun anotherChild(body: DslAnotherChild.() -> Unit) {
|
||||
body(DslAnotherChild())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslChild {
|
||||
operator fun String.unaryMinus() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
@DslMarker
|
||||
annotation class SimpleOtherDsl
|
||||
|
||||
@SimpleOtherDsl
|
||||
class DslOtherChild {
|
||||
fun otherThing() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleOtherDsl @SimpleDsl
|
||||
class DslAnotherChild {
|
||||
|
||||
}
|
||||
|
||||
fun dsl(body: DslRoot.() -> Unit) {
|
||||
body(DslRoot())
|
||||
}
|
||||
|
||||
fun test() {
|
||||
dsl {
|
||||
container {
|
||||
child {
|
||||
-"Some"
|
||||
|
||||
}
|
||||
otherChild {
|
||||
otherThing()
|
||||
anotherChild {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: {lookupString:"otherThing", attributes:["grayed"]}
|
||||
// EXIST: {lookupString:"child", attributes:["grayed"]}
|
||||
// EXIST: {lookupString:"otherChild", attributes:["grayed"]}
|
||||
@@ -0,0 +1,38 @@
|
||||
@DslMarker
|
||||
annotation class SimpleDsl
|
||||
|
||||
@SimpleDsl
|
||||
class DslRoot {
|
||||
fun container(body: DslContainer.() -> Unit) {
|
||||
body(DslContainer())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslContainer {
|
||||
fun child(body: DslChild.() -> Unit) {
|
||||
body(DslChild())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslChild {
|
||||
operator fun String.unaryMinus() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun dsl(body: DslRoot.() -> Unit) {
|
||||
body(DslRoot())
|
||||
}
|
||||
|
||||
fun test() {
|
||||
dsl {
|
||||
container {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: {"lookupString":"child", "attributes":["bold"]}
|
||||
// EXIST: {"lookupString":"container", "attributes":["grayed"]}
|
||||
@@ -0,0 +1,35 @@
|
||||
@DslMarker
|
||||
annotation class SimpleDsl
|
||||
|
||||
@SimpleDsl
|
||||
class DslRoot {
|
||||
fun container(body: DslContainer.() -> Unit) {
|
||||
body(DslContainer())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslContainer {
|
||||
fun child(body: DslChild.() -> Unit) {
|
||||
body(DslChild())
|
||||
}
|
||||
}
|
||||
|
||||
@SimpleDsl
|
||||
class DslChild {
|
||||
operator fun String.unaryMinus() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
|
||||
fun dsl(body: DslRoot.() -> Unit) {
|
||||
body(DslRoot())
|
||||
}
|
||||
|
||||
fun test() {
|
||||
dsl {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: {"lookupString":"container", "attributes":["bold"]}
|
||||
Reference in New Issue
Block a user