Skip to content

Cannot complete Receiver Properties #18

Open
@kai-jellinghaus

Description

@kai-jellinghaus

Hi! Very excited to see this happening.

One of the main use cases I have for VSC is editing DSL files. For this it would be very nice if the LSP implementation could complete properties of the receiver type even without providing things.

Overview

I'd like the LSP be to gain the ability to complete receiver properties, even without the user typing. In any lambda or function with a receiver the properties (and methods) of that receiver should be suggested, even when there are no preceding characters to filter with.

There's a second, much less relevant issue where the LSP won't order suggestions particularly well, but that's a different problem that's not such an issue.

Detailed Repro

In DSL / Builder patterns it's very common to have something like this:

class Builder {
    var myInput: String?
}

fun build(block: Builder.() -> Unit) // implementation elided

using it like so:

build {
    myInput = "Hello, world!"
}

Now, in IntelliJ this is very discoverable for the user, given input like so

build {
    <completion>
}

It will list all receiver properties first, which seems "correct" to me. LSP is currently not able to generate completions at all. At based word-based.

For something like:

build {
    m<completion>
}

Both IntelliJ & LSP are able to generate completions, but LSP sorts these poorly, and mixes in a lot of irrelevant elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions