Andre-Littoz - 2015-01-31

LXR is a great tool for exploring code written by others. However it suffers also a big handicap.

Understanding tricky code fragments often requires to scribble down some notes on a sheet of paper. When weeks later you relaunch LXR to read the some code, you probably have lost that paper and you don't remember why you should be cautious with this code.

The problem could be alleviated if the comments could be kept with the source-tree in the associated database itself.

How could this be implemented?

  • database: a new table of records with fields fileid (pointing to a file in a specific version), linenumber and a free-text blob to host the comment

  • source display: the line area can be split between the source-line (highlighted as today) and the optionally displayed comment area (as static text)

In order not to transform the source listing into a huge <FORM> with thousands of editable <INPUT> fields (which would adversely impact performance), we need a mechanism to select the line we want to edit:

  • initial comment insertion
  • comment display
  • comment edit
  • comment erasure
  • eventually, comment import from other version from same or different line

I thought comment edit could be triggered from an <A> link under the line number, but this conflicts with the request to be able to copy-and-paste a self-reference to this line (as it was in older LXR releases).

In my initial idea, comments would be displayed (if not enabled by an option) while hovering with the mouse above the line number, i.e. as a tooltip using the title= attribute of the <A> link.

Please comment and make suggestions

 
Last edit: Andre-Littoz 2015-02-02