Edgewall Software

Opened 12 years ago

Last modified 7 years ago

#9655 new enhancement

Source code navigation in browser

Reported by: Itamar Ostricher Owned by:
Priority: normal Milestone: next-major-releases
Component: version control/browser Version:
Severity: normal Keywords: mimeview postprocessing
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


It would be very cool if when viewing source code in Trac source browser, it will render the language elements (e.g. functions, methods, classes, module imports / includes) as links to where they are defined (like most IDEs).

The lacking of this is the only reason that my team uses SlickEdit for code-reviews, and not Trac browser. (well, this and the ability to annotate the reviewed code with comments, but that's another enhancement request).

Now, I assume this is a heavy feature (language awareness?!), but thought I'd raise it anyway. Maybe it can be done partially using other libraries (I guess Pygments is doing something similar, syntax-analysis or something of that sort).

Attachments (1)

9655-proof-of-concept.patch (6.5 KB ) - added by Christian Boos 12 years ago.
to follow up on comment:1 and get this started…

Download all attachments as: .zip

Change History (5)

comment:1 by Christian Boos, 12 years ago

Milestone: 0.13

That's a very cool idea … and I thought about doing exactly that myself a few dozen times already :-) So let's get around to it.

Using Pygments would indeed be the most logical way. We would just need to put something back in the mimeview Context hints (say a "tableofcontent" entry containing the already formatted TOC… or even just the structured tree with links, so that we could reuse it for other purposes), and add ids in the output as appropriate.

by Christian Boos, 12 years ago

Attachment: 9655-proof-of-concept.patch added

to follow up on comment:1 and get this started…

comment:2 by Christian Boos, 12 years ago

Owner: set to Christian Boos

comment:3 by Christian Boos, 12 years ago

Milestone: 0.13next-major-0.1X

I have a more advanced patch but I hit the limitations of this approach. Lexical analysis as done by Pygments can only provide you with a list of identifiers, and this is only half-way useful (i.e. you get no robust class / method relationship for example).

So to implement that "for real", we'd need to have components able to do syntactic analysis (and eventually cache the result).

comment:4 by Ryan J Ollos, 7 years ago

Owner: Christian Boos removed

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.