Groovy Eclipse Plugin - parentheses behavior with code completion

View: New views
2 Messages — Rating Filter:   Alert me  

Groovy Eclipse Plugin - parentheses behavior with code completion

by Guillaume Jeudy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

I’m just sharing thoughts on parentheses behavior with code completion. Currently the behavior doesn’t seem consistent and I haven’t seen a way to control it in the formatter.

 

For example in my GroovyTestCase if I type:

assertSame

 

Press CTRL-space for code completion, select 1 method from the list then parentheses are populated like so:

 

assertSame(expected, actual)

 

Now if I type:

 

MAP = [key1: new Object(), key2: new Object()]

assert MAP.dump().contains

 

Press CTRL-space for code completion and select 1 method from the list then parentheses are not populated like so:

 

MAP = [key1: new Object(), key2: new Object()]

assert MAP.dump().contains s

 

What I would like is consistent behavior and a way to control this, i.e. always populate parentheses or not.

 

I would prefer to always have the parentheses as this help remove any ambiguities as recommended in Groovy In Action book.

 

Regards,

Guillaume Jeudy – Java developer
Java and Open Source Application Development – Montreal Solutions Centre
1801, McGill College Avenue, Suite 1100
Montreal, QC, H3A 2N4

gjeudy@...
W: +1-514-840-6329           F: +1-514-840-6241

 



This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.

 

 

Ce courrier électronique (en incluant n'importe quels attachements) peut contenir des renseignements

qui sont donnés le privilège, confidentiel, et-ou protégés autrement de la divulgation à quelqu'un autre

que son destinataire (s) voulu. N'importe quelle diffusion ou utilisation de ce courrier électronique

électronique ou de ses contenus (en incluant n'importe quels attachements) par les personnes autre que

le destinataire (s) voulu sont sévèrement interdits. Si vous avez reçu ce message par erreur, notifiez-nous

s'il vous plaît immédiatement par le courrier électronique de réponse pour que nous puissions corriger nos

dossiers intérieurs. Effacez s'il vous plaît alors le message original (en incluant n'importe quels attachements)

dans son ensemble. Merci.


Re: Groovy Eclipse Plugin - parentheses behavior with code completion

by Andrew Eisenberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You are right that this option should be user configurable.  The
current approach is to add parens when there are no arguments, but no
parens when arguments exist.  Also, closure arguments are replaced
with '{ }'.  The hope is to make content assist more "Groovy", but
this comes with obvious problems, such as the ambiguity you describe
below.

I am guessing that the default parameters for content assist should be
what is considered best practice, and then this should be configurable
to account for custom tastes that fall within the bounds of legality.

Guillaume, can you raise a bug for this and we can start to iterate on
what the configurable options should be?  And, yes, these options
should eventually be pushed into the groovy formatter, but that is a
different story.

--a

ps- again, please raise these issues on the eclipse-plugin-user or
eclipse-plugin-dev mailing lists where you will be able to get a
better response.


On Tue, Nov 3, 2009 at 7:26 AM, Jeudy, Guillaume <gjeudy@...> wrote:

> Hi,
>
>
>
> I’m just sharing thoughts on parentheses behavior with code completion.
> Currently the behavior doesn’t seem consistent and I haven’t seen a way to
> control it in the formatter.
>
>
>
> For example in my GroovyTestCase if I type:
>
> assertSame
>
>
>
> Press CTRL-space for code completion, select 1 method from the list then
> parentheses are populated like so:
>
>
>
> assertSame(expected, actual)
>
>
>
> Now if I type:
>
>
>
> MAP = [key1: new Object(), key2: new Object()]
>
> assert MAP.dump().contains
>
>
>
> Press CTRL-space for code completion and select 1 method from the list then
> parentheses are not populated like so:
>
>
>
> MAP = [key1: new Object(), key2: new Object()]
>
> assert MAP.dump().contains s
>
>
>
> What I would like is consistent behavior and a way to control this, i.e.
> always populate parentheses or not.
>
>
>
> I would prefer to always have the parentheses as this help remove any
> ambiguities as recommended in Groovy In Action book.
>
>
>
> Regards,
>
> Guillaume Jeudy – Java developer
> Java and Open Source Application Development – Montreal Solutions Centre
> 1801, McGill College Avenue, Suite 1100
> Montreal, QC, H3A 2N4
>
> gjeudy@...
> W: +1-514-840-6329           F: +1-514-840-6241
>
>
>
> ________________________________
> This electronic mail (including any attachments) may contain information
> that is privileged, confidential, and/or otherwise protected from disclosure
> to anyone other than its intended recipient(s). Any dissemination or use of
> this electronic email or its contents (including any attachments) by persons
> other than the intended recipient(s) is strictly prohibited. If you have
> received this message in error, please notify us immediately by reply email
> so that we may correct our internal records. Please then delete the original
> message (including any attachments) in its entirety. Thank you.
>
>
>
>
>
> Ce courrier électronique (en incluant n'importe quels attachements) peut
> contenir des renseignements
>
> qui sont donnés le privilège, confidentiel, et-ou protégés autrement de la
> divulgation à quelqu'un autre
>
> que son destinataire (s) voulu. N'importe quelle diffusion ou utilisation de
> ce courrier électronique
>
> électronique ou de ses contenus (en incluant n'importe quels attachements)
> par les personnes autre que
>
> le destinataire (s) voulu sont sévèrement interdits. Si vous avez reçu ce
> message par erreur, notifiez-nous
>
> s'il vous plaît immédiatement par le courrier électronique de réponse pour
> que nous puissions corriger nos
>
> dossiers intérieurs. Effacez s'il vous plaît alors le message original (en
> incluant n'importe quels attachements)
>
> dans son ensemble. Merci.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email