login | login/register with OpenId | register | help
Create a symbol list (and quick search) plugin for gedit


Estimated time: 10 hours

Description

I want to add functionality equivalent to E-Texteditor's symbol list on gedit. It's very convenient, fast, and allows painless (and RSI-less) keyboard-only code browsing.

Longer explanation: I want to create a plugin that displays a list of symbols in the current source file, allows the user to double-click on any item in the list to go to that symbol on the source file and has a small search box on top (linked to a keyboard shortcut) that filters the symbols using a "fuzzy" search.

There are currently two plugins that do something similar to what I want but both have severe shortcomings. ClassBrowser, which is the one closes to what I want, is extremely slow for big files, and tends to replicate the exact parse tree in the view, thus making it as painful to browse the list as it is to browse the code itself; Symbol List is written in C (I don't mind C that much, but I'd like the process of adding new parsers to be as painless as possible, thus I'd rather use Python to write the language)

Technologies

I propose Python, maybe CTags to generate tags for known files and then custom parsers for things like markup, template languages and CSS.

I think the best bet would be to start by using ClassBrowser as a base for the new plugin. ClassBrowser is already written in Python, solves many of the problems inherent to such a plugin (tracking current file, updating the symbol list on save, parsing CTags files, etc.) and is quite well engineered.

Tasks

  1. Modify ClassBrowser to use a list instead of a treeview, or maybe keep the treeview but aggregate the symbols under symbol categories (e.g: classes, functions, variables) instead of creating a complete parse tree of the code
  2. Simplify HTML parser so it only displays those tags which have an "id", "class" or "name" attribute
  3. Write a CSS parser, possibly just using regexes to just extract rule names (we only care about rule names, not the properties)
  4. Add search box on top of listbox (I already have this code)
  5. Eventually add other parsers for stuff like Ruby-related source files, Django templates (listing defined blocks as symbols is very useful), etc.
Comments
Project author and members receive automatic email notifications when comments are posted.

No comments for the moment.

You could add a comment if you were logged in.