Context Sensitive Browsing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Context Sensitive Browsing

Camillo Bruni
I just implemented some hacky solution to have more intelligent CMD-b browsing. For instance in the following example:

        Exception handles:

having the cursor somewhere on the handles: selector and pressing CMD-b should directly jump to the implementation of handles: on the Exception class.

Now the way I do it so far is rather brain dead. I select the word under the cursor and check if the preceding word is either a keyword or a constant using pattern matching. Now of course this is neither flexible nor nice to code. The solution would be to use the AST and map directly from the sources to the AST.

Is there a way to get from the sources / compiled method to the AST?

m(^_-)m
camillo


Reply | Threaded
Open this post in threaded view
|

Re: Context Sensitive Browsing

Lukas Renggli
See the OB commands for the source code refactorings. Alternatively
you could use eCompletion, it can give type assumptions at arbitrary
positions in the source code (doesn't een need to fully parse).

Lukas

On Tuesday, 22 February 2011, Camillo Bruni <[hidden email]> wrote:

> I just implemented some hacky solution to have more intelligent CMD-b browsing. For instance in the following example:
>
>         Exception handles:
>
> having the cursor somewhere on the handles: selector and pressing CMD-b should directly jump to the implementation of handles: on the Exception class.
>
> Now the way I do it so far is rather brain dead. I select the word under the cursor and check if the preceding word is either a keyword or a constant using pattern matching. Now of course this is neither flexible nor nice to code. The solution would be to use the AST and map directly from the sources to the AST.
>
> Is there a way to get from the sources / compiled method to the AST?
>
> m(^_-)m
> camillo
>
>
>

--
Lukas Renggli
www.lukas-renggli.ch