Yes, perhaps we could add a new language service (cf. IDE service) to expose "implements" relationships.
Specifically, how about something like this:
interface IImplementationResolution { Set<Object> getImplementations(Object entity); }
This could be exposed in the UI similarly to the way the JDT exposes the type hierarchy-related query that's bound to Cmd-T/Control-T. E.g., if the cursor's on a type name in a language with a type hierarchy, you get the sub-types. If the cursor's on an interface/class method in an OO language, you get the implementations/overrides. If the cursor's on a non-terminal name in a grammar, you get the corresponding production rules.
Comments? On Nov 27, 2009, at 7:31 AM, Jurgen Vinju wrote: Hi Bob, Should we add a separate IMP service for more or more advanced source hyperlinking, next to "reference resolver" then? Cheers, Jurgen On Thu, Nov 26, 2009 at 7:34 PM, Robert M. Fuhrer < rfuhrer@xxxxxxxxxxxxxx> wrote: Oops, I was forgetting about grammars. On the other hand, I'd argue that
what you're talking about aren't declarations. In other words, grammars
don't really declare non-terminals, since all non-terminals have the same,
trivial "interface", analogous to a method's signature, which governs legal
references (call sites). The production rules act more like implementations,
analogous to method bodies.
As for Java and interface method implementations, the JDT for example
provides access to that info via a separate UI command, presumably due to
the expense of computing the set of all the method's implementations (O(# of
derived classes * # of methods/class)), as compared to the expense of
identifying the single declaration site (basically O(1)).
On Nov 26, 2009, at 8:05 AM, Jurgen Vinju wrote:
Hi Bob,
I'm not sure the reference resolver should support multiple targets - it's
intended to go from ref to declaration, and hopefully there's only one
declaration of any given entity. I can't think offhand of a language that
has multiple *declaration* sites for a given entity. Though if there really
are such languages, we could certainly change the IReferenceResolver API to
handle that. The UI would presumably pop up a menu allowing the user to
select the appropriate destination, if there's a choice.
I'm thing of BNF and SDF for example:
Exp ::= Exp "+" Exp
and in a different module
Exp ::= Exp "*" Exp
It would be nice to see all the definitions of Exp when clicking on
some use of it, e.g.:
Stat ::= "if" "(" Exp ")" Stat
Having said that, you might want to click on a Java abstract method
declaration or call site and see all of its implementations too.
-- Cheers, - Bob ------------------------------------------------- Robert M. Fuhrer Research Staff Member Programming Technologies Dept. IBM T.J. Watson Research Center
|