groovy / groovy/groovy-eclipse

each on a collection is not enough promoted on content assist

Open
#674 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
681
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Somewhat related to #411.

Consider the following code:

new List().eac|

Invoke content assist at "|": it's quite clear and obvious that I want to invoke one of the each methods supplied as DGMs, but Greclipse as a first option shows forEach method.
I understand that content assist priority is currently determined first by group, than by name matching (giving more priority to class methods rather than DGMs), but I personally think that prefix and exact matches should ALWAYS be given maximum priority. It's even more evident when you type new List().each| and invoke content assist, it's quite natural that Greclipse should suggest each before forEach.

Also, the implementation detail on how DGMs are provided by Groovy I think should be, as said, an implementation detail to the Groovy developer: from a developer (I mean, consumer of Greclipse) point of view, the fact that each is not defined on List but rather as a DGM should not matter in any way. It could be reasonable to give DGMs less relevance (like you do for methods deeply inherited in class hierarchy) than methods directly defined in the declared type, but IMHO prefix vs substring matching should be the first priority factor when deciding what to show first.

After all, if I want to type each (and I know I want to type each) it's annoying that Greclipse suggests me that I want to type forEach instead, especially when you have content assist auto activation and you then type a trigger character.
Also consider that, in this particular case, each, even though defined as a DGM for Object, fits perfectly and naturally on collection classes and in this way Greclipse makes it "hard" to use.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the content-assist cases new List().eac| and new List().each| in Greclipse, comparing the ordering of the DGM each methods with forEach. Trace the ranking rules for group, prefix, exact, and substring matches; done means prefix and exact each proposals appear ahead of forEach in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.