GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-616

missing completion proposals when parentheses are absent in method call

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0RC1
    • Fix Version/s: 2.0.1Release
    • Component/s: Content Assist
    • Labels:
      None
    • Environment:
      latest snapshot
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      the following code offers the correct proposals when pressing Ctrl+space with the cursor after VAL

      class CompletionStatic {
      	
      	private static final String VALUE1 = "1"
      	private static final String VALUE2 = "2"
      	
      	def method() {
      		Collections.sort(VAL)
      	}
      }
      

      if you remove the parenthesis of the sort method - Collections.sort VAL - then VALUE1 and VALUE2 are not shown any more in code completion

        Activity

        Hide
        Andrew Eisenberg added a comment -

        Interesting...I'll have a look.

        Show
        Andrew Eisenberg added a comment - Interesting...I'll have a look.
        Hide
        Andrew Eisenberg added a comment -

        Ahh...I see what is happening here. Most groovy fields are automatically converted into properties by the compiler. The content assist engine prefers to show property proposals over field proposals. So, it tries to filter out all field proposals that are duplicated by a property proposal. It looks like the field proposal for VALUE1 and VALUE2 were being filtered when they shouldn't be.

        The behavior that I am seeing is different from what you describe. I see that VALUE1 and VALUE2 are never proposed regardless of the existence of the parens. Is this what you are seeing, too?

        Show
        Andrew Eisenberg added a comment - Ahh...I see what is happening here. Most groovy fields are automatically converted into properties by the compiler. The content assist engine prefers to show property proposals over field proposals. So, it tries to filter out all field proposals that are duplicated by a property proposal. It looks like the field proposal for VALUE1 and VALUE2 were being filtered when they shouldn't be. The behavior that I am seeing is different from what you describe. I see that VALUE1 and VALUE2 are never proposed regardless of the existence of the parens. Is this what you are seeing, too?
        Hide
        Andrew Eisenberg added a comment -

        OK...found this on http://docs.codehaus.org/display/GROOVY/Groovy+Beans

        Property and field rules

        When Groovy is compiled to bytecode, the following rules are used.

        • If the name is declared with an access modifier (public, private or protected) then a field is generated.
        • A name declared with no access modifier generates a private field with public getter and setter (i.e. a property).
          ...

        This is not the way that property lookups are done for content assist. I will change the way content assist works so that these rules are used. However, this fix will not make it into V2.0.

        Show
        Andrew Eisenberg added a comment - OK...found this on http://docs.codehaus.org/display/GROOVY/Groovy+Beans Property and field rules When Groovy is compiled to bytecode, the following rules are used. If the name is declared with an access modifier (public, private or protected) then a field is generated. A name declared with no access modifier generates a private field with public getter and setter (i.e. a property). ... This is not the way that property lookups are done for content assist. I will change the way content assist works so that these rules are used. However, this fix will not make it into V2.0.
        Hide
        Andrew Eisenberg added a comment -

        I can do a fix for most of this, but until GRECLIPSE-512 is closed, there will be some duplicate proposals in content assist.

        Show
        Andrew Eisenberg added a comment - I can do a fix for most of this, but until GRECLIPSE-512 is closed, there will be some duplicate proposals in content assist.
        Hide
        Andrew Eisenberg added a comment -

        OK. Tests for this are passing locally for the part that is independent of GRECLIPSE-512. Won't commit or close this bug until after 2.0 final is released.

        Show
        Andrew Eisenberg added a comment - OK. Tests for this are passing locally for the part that is independent of GRECLIPSE-512 . Won't commit or close this bug until after 2.0 final is released.
        Hide
        Andrew Eisenberg added a comment -

        Available in latest snapshot now.

        Show
        Andrew Eisenberg added a comment - Available in latest snapshot now.

          People

          • Assignee:
            Andrew Eisenberg
            Reporter:
            Xavier Lemaignen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: