Skip to content

[bean completion proposals] completions show up at class level #1528

Closed

Description

@martinlippert

It looks like bean completions show up at class level, too, and produce weird results. If we show them up at class level (basically as a simplified mechanism to add a new field), it should at least show up consistently and produce correct results.

@Component
public class AnotherTestConfigClass {

    <*>
    
}

This does not cause bean proposals to show up.

@Component
public class AnotherTestConfigClass {

    t<*>

    AnotherTestConfigClass() {
    }
    
}

This shows up bean completions (assuming there are beans with a name starting with t).
Applying the bean completion proposal results in:

@Component
public class AnotherTestConfigClass {

    private final TestBean1 testBean1;

    AnotherTestConfigClass(TestBean1 testBean1) {
        this.testBean1 = testBean1;
    }

    testBean1<*>

    AnotherTestConfigClass() {
    }
    
}

which looks good in general, but the existing constructor hasn't been taken into account.

Interestingly, having the pre-existing constructor public:

@Component
public class AnotherTestConfigClass {

    t<*>

    public AnotherTestConfigClass() {
    }
    
}

causes the bean completion proposals do NOT show up anymore.

Activity

  1. added this to the 4.30.0.RELEASE milestone on Mar 26, 2025
  2. BoykoAlex commented on Mar 31, 2025

    @BoykoAlex
    Contributor

    @martinlippert I cannot reproduce this one... Have you done any work in that area?

  3. martinlippert commented on Apr 2, 2025

    @martinlippert
    MemberAuthor

    @BoykoAlex I haven't done any work on this and I can still reproduce this... :-)
    I am using VSCode, connected to a language server running from main.

  4. BoykoAlex commented on Apr 3, 2025

    @BoykoAlex
    Contributor

    Fixed. Limit bean completions to block not belonging to type declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: vscodetheme: code completiontype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions