|
RE: Re[1]: [cedet-semantic] FW: [ECB-list] Analyse/completion buffer on Java classes
From: Nascif Abousalh-Neto <Nascif.AbousalhNeto@sa...> - 2005-11-21 02:03
|
Hi,
> -----Original Message-----
> From: Eric M. Ludlam [mailto:eric@...]
> Sent: Saturday, November 19, 2005 8:12 AM
> To: Nascif Abousalh-Neto
> Cc: cedet-semantic@...
> Subject: Re[1]: [cedet-semantic] FW: [ECB-list]
> Analyse/completion buffer on Java classes
>
> Howdy,
>
> I'm not 100% sure what ECB does, but I seem to recall it
> uses the command 'semantic-analyze-current-context', which by
> itself will just display the slots in the object it creates.
I copied Klaus so that he confirm that, but I think you're right.
> If you do:
>
> M-x semantic-analyze-current-context RET
>
> you can see what it thinks. You can also use
>
> M-x semantic-analyze-possible-completions RET
>
> to see what it thinks of the completions.
>
>
> As your example file below is incomplete, and it doesn't know
> what 'object' is, the completion engine goes back and just
> tries a more general search. Here is a comment from the code:
"object" is a data member (or member variable) in the containing class. =
I tried the comments above and my impression is that semantic recognizes=
the variable as a prefix, but not as the scope for completion; it uses =
the containing class as the scope.
Here is a more complete exampe:
public class InfoBus {
private Logger _log;
private InfoBus() {
_log =3D Logger.getLogger(PACKAGE_NAME);
_consumerMap =3D new HashMap();
_log.i // <<<<< point location
} // InfoBus constructor
Context:
Context Type: #<semantic-analyze-context context>
Bounds: (2003 . 2004)
Prefix: private Logger _log
"i"
Prefix Classes: 'function
'variable
Prefix Types: 'nil
--------
Scope Types: public class InfoBus {private static final String PACKAGE_N=
AME,private static final Class[] HANDLER_PARAMS,private static InfoBus _=
_instance,private Map _consumerMap,private Logger _log,public static voi=
d init (),public static InfoBus getInstance (),private InfoBus (),public=
void send (Topic topic),public void send (Topic topic,Object data),publ=
ic void addConsumer (Topic[] topics,Consumer consumer),public void addCo=
nsumer (Topic[] topics,Consumer consumer,boolean blocking),public void a=
ddConsumer (Topic topic,Consumer consumer),public void addConsumer (Topi=
c topic,Consumer consumer,boolean blocking),public void removeConsumer (=
Topic[] topics,Consumer consumer),public void removeConsumer (Topic topi=
c,Consumer consumer),public boolean hasConsumer (Topic topic),public boo=
lean isConsumer (Topic topic,Consumer consumer),public void reset ()}
Scope: private static final String PACKAGE_NAME
private static final Class[] HANDLER_PARAMS
private static InfoBus __instance
private Map _consumerMap
private Logger _log
public static void init ()
* Completions:
public static void init ()
public boolean isConsumer (Topic topic,Consumer consumer)
Regards,
Nascif
>
>
> =09;; No type based on the completetext. This is a free-range
> =09;; var or function. We need to expand our search beyond this
> =09;; scope into semanticdb, etc.
>
> after which is searches through all sorts of other tag tables.
>
> In the output of `semantic-analyze-current-context', you
> would need to figure out why it doesn't know what 'object' is.
>
> Eric
>
> >>> "Nascif Abousalh-Neto" <Nascif.AbousalhNeto@...>
> seems to think that:
> >Oh CEDET gurus,
> >
> >I have a question about the behavior of the ECB analyse
> buffer (which
> >displays semantic information for the node at point) for a Java file.
> >
> >When I have point positioned in front of a variable name
> with a partial
> >method name, the *analys* buffer gives me completion options for the
> >containing class, not for the variable - which it seems to recognize
> >correctly as the "prefix".
> >
> >like:
> >
> >Public class MainClass {
> >
> > public void doThis() { ...
> >
> > public void aMethod() {
> > ....
> > object.doTh|
> >
> >In this case "doThis" is listed as a valid completion even
> though it is
> >not a valid method in "object".
> >
> >This behavior is quite confusing...
> >
> >I remember reading something about a new wisent parser/grammar that
> >would undertand the internals of methods in a Java file, as
> opposed to
> >just the methods and variables as it is today. Would it be
> possible to
> >enable it for Java and thus get a true context-sensitive completion?
> [ ... ]
>
|
| Thread | Author | Date |
|---|---|---|
| RE: Re[1]: [cedet-semantic] FW: [ECB-list] Analyse/completion buffer on Java classes | Nascif Abousalh-Neto <Nascif.AbousalhNeto@sa...> |