LXR does not cross-reference Javascript



17 years ago
10 years ago


(Reporter: Adam Fletcher, Assigned: Adam Fletcher)



Firefox Tracking Flags

(Not tracked)



(1 attachment, 3 obsolete attachments)



17 years ago
LXR does not cross reference javascript, so doing searches for identifiers in
javascript is a pain, and this slows down work for XUL/UI development (at least,
it does at my company :) )

Comment 1

17 years ago
Created attachment 62208 [details] [diff] [review]
Patch to Common.pm for javascript indexing

Attaching patches to genxref and to Common.pm

patches are made with diff -C 2 newfile originalfile

Know issues: Identifiers with the same name in C/C++ and JS are indexed between

both langauges, with the C/C++ instance taking priority. For example, if the
C/C++ has:

int bobsYourUncle;

and the JS has:

var bobsYourUncle;

LXR will tell the user it is declared in the C/C++ and make all other
of bobsYourUncle link to the C/C++ declaration.

Also, I had to remove fileidx and xref before I ran the new genxref.

Comment 2

17 years ago
Created attachment 62209 [details] [diff] [review]
Patch to genxref for javascript indexing

Patch as per above comment.

Comment 3

17 years ago
um. your patch is against genxref 1.2. tip is 1.5, there are conflicts.
also, your patch is -Reversed and not a cvs diff.  I'll try to rehab.

beyond that, some of your changes will conflict with my idl patch.

Comment 4

17 years ago
Created attachment 62273 [details] [diff] [review]
untested cvs diff -u w/ conflicts resolved

the other file was against Common.pm 1.12 or older (Current is 1.23)
Attachment #62208 - Attachment is obsolete: true
Attachment #62209 - Attachment is obsolete: true

Comment 5

17 years ago
Timeless - I didn't checkout the mozilla version, instead went with the 0.3
version from the lxr distro site. My bad. Thanks for the cleanup - this is my
first patch and wasn't sure the proper methods.

My patch was against unmodified lxr-0.3, the current stable release. The current
development release is lxr-0.9, which my patch would do nothing but harm to. :)

lxr-0.9 doesn't support javascript either, but it looks to be a much simpler
addition then 0.3. It appears that mozilla.org is running a modified 0.3, so the
patch remains vaild, but the features added in 0.9 are amazing - languages are
based on whatever ectags supports (including perl, make, java), the backend is
database driven and the updates to the xref database is done incrementaly (sp?).
Just a FYI.

Switching to the latest LXR (dev version) and latest ctags should make it easy
to support JS. ctags 5.5 brought support for JS according to ctags changelog. We
have several languages in the Mozilla tree and it would be really nice to do
something about LXR to support them...

Comment 7

12 years ago
sorry for the amazing delay, not sure what's going on, but afaik since running
with this patch, i get problems relating to ident results.


i've finally started to half understand the corruption in mxr-test ident
i'm looking for soneone who can try to figure out what's going wrong
is the ident code, and the other related files are siblings. if someone
needs the db, it's of course on landfill, but probably not exposed by apache.

it's quite possible that the bad output is my fault, but, i don't have real time
to look into this problem (it's taken me well over a year to get around to
at least recognizing half of what's going wrong...).
Keywords: helpwanted

Comment 8

12 years ago
Created attachment 225362 [details] [diff] [review]

here are the main problems that i ran into with adam's patch:
file numbers were stomped on, which resulted in C identifiers pointing to random js files
#defines were busted
typedefs didn't work

I've fixed file references and defines. and I think most of typedefs.

As can probably be seen by this patch, I decided that I didn't like the parsing algorithm used for JS, so I kind of rewrote a portion of it.

This is not live on landfill because my ssh connection to landfill is really hard to reach. I'll stick it up shortly.
Assignee: adamf → timeless
Attachment #62273 - Attachment is obsolete: true


12 years ago
Attachment #225362 - Flags: review+
QA Contact: timeless → lxr

Comment 9

10 years ago
So is it fixed now ?


10 years ago
Assignee: timeless → adamf

Comment 10

10 years ago
mozilla/webtools/lxr/genxref 	1.6
Last Resolved: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.