Question regarding autocompletion. In the followin...
# dsl
m
Question regarding autocompletion. In the following example the variable
foo
in the DSL scope is almost always supposed to be used as a function and has
operator fun invoke
. Manually writing
foo("abc")
works fine. However autocompletion will complete
fo<caret>
as
foo<caret>
, instead of
foo(<caret>)
like it would for functions. That means DSL users have to type a lot more (there are hundreds of such instances). If they’re new to the DSL they may not even see that such properties can be invoked as a function. Is there any way or trick to make the IDE autocomplete
foo
as a function invocation by default?
Copy code
class Foo { operator fun invoke(bar: String) }
object FooScope { val foo = Foo() }

fun dslTest() {
	with(FooScope) {
		fo<caret>
	}
}
m
voted 👍
👍 1
nice catch!