Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#76 CtagsInterface: Custom ctags search actions

closed-fixed
None
5
2010-06-12
2010-05-16
Dion Amago
No

There are great code navigation shortcuts in Eclipse such as searching for classes via a prefix, or listing all members of the current class. This small modification to CtagsInterface actions allows custom sql actions to use a popup query dialog, rather that getting the tag name from the buffer.

Example:
An action that finds classes only, starting the with prefix in the search popup.
An action that lists only members of the current class.
An action that lists all classes in the current project.

Discussion

  • You forgot to include QuickSearchTagDialogCustom in the patch.

     
  • Dion Amago
    Dion Amago
    2010-05-17

    new svn diff with QuickSearchTagDialogCustom

     
    Attachments
  • Dion Amago
    Dion Amago
    2010-05-17

    This diff should work. Revert and reapply.

     
  • The patch uses a new class, QuickSearchTagDialogCustom, which was not part of CtagsInterface. Since the patch doesn't include this new class, the patched version won't compile...

     
  • Dion Amago
    Dion Amago
    2010-05-17

    Yes, the first diff doesn't have the new class, but the second one does. I tested it on fresh checkout. Sourceforge won't let me delete the first diff file, so make sure you grab the second one.
    Or you could just grant me commit access.

     
  • Can you explain how this works? As a user, what am I supposed to do to get the above examples to run?
    A few small things:
    - There's bug in the creation of the query when JUMP_TO_TAG is used - the line "s = (tag == null) ? query : query.replace(TAG, tag);" neglects the previous replacement of the project name.
    - I think it's better to add the new functionality of the custom pop up into the existing class rather than make everything protected and create another class.

     
  • In addition, "ILIKE" is not part of the SQL supported by hsqldb.

     
  • Dion Amago
    Dion Amago
    2010-05-17

    Regarding "ILIKE": ah yes, that slipped in there. I was experimenting with the case insensitive searching (using Postgresql).
    To use:
    To search for classes by prefix:
    SQL query: SELECT TAGS.*,FILE FROM TAGS,FILES WHERE FILE_ID=ID AND TAGS.A_KIND='class'
    Query type: "Search Prefix"
    Call query immediately: "false"
    To list functions and variables of the current class:
    SQL query: SELECT TAGS.*,FILE FROM TAGS,FILES WHERE FILE_ID=ID AND (TAGS.A_KIND='function' OR TAGS.A_KIND='variable') AND FILE='{file}'
    Query type: "Search Prefix"
    Call query immediately: "true"
    Bind the actions to a shortcut.

    Regarding new functionality: sure, that makes sense, although then that involves code duplication, but I it's not complex code, so that's probably maintainable.

     
  • First, thanks a lot for the patch, it adds useful functionality.
    I'll make a few small changes, e.g. there are 2 small bugs I found with the queries (except for the "ilike" issue).
    I'll also merge the two classes related to the popup.
    BTW, this is the first time I ever saw this feature of associating strings with enum values. Thanks for showing me that... I didn't know it existed.

    The new features should also be documented in the plugin help files.

    Finally, regarding your examples below: I now understand what you mean,but these queries don't really do what their title says. E.g. to find all members of the current class, you don't query by file - you query by class (a_class=...). In C++, the members can be scattered (at least the definitions). In Java, there may be several classes inside the same file. Moreover, the members are not necessarily functions or variables (e.g. enums, constants etc.) But thanks for the idea.

    BTW, some time soon I'm going to change CtagsInterface to use Lucene instead of a relational database. This will not change the functionality, only the way the queries are built.

     
  • Applied in SVN rev. 17843.

     
    • assigned_to: nobody --> shlomy
    • status: open --> closed-fixed
     
  • Even though I applied it, I feel that the UI is very not user-friendly. Leaving it open to improve the UI.
    It should be clear what each of the dynamic action options means.
    Perhaps even separate the dynamic actions to two different sets - those that "jump to tag" and those that open the quick tag search popup.
    Also, the new feature needs documentation.

     
    • labels: 826387 -->
    • status: closed-fixed --> open-fixed
     
    • status: open-fixed --> closed-fixed