aemide / issue-tracker

0 stars 0 forks source link

Can't search in the attached felix bundles #6

Open royteeuwen opened 4 months ago

royteeuwen commented 4 months ago

When I use the plugin to attach the felix bundles as dependencies, they do not get searched in when doing a find in Project and Libraries.

An often used case is that you want to search for a string (servlet path, resource type, ...) in one of the bundles, so having this search would make it a lot more powerful

karollewandowski commented 4 months ago

Hi Roy, Do you mean searching for strings in class files? If yes, unfortunately, it is unsupported on the platform level. I guess it would require decompiling each class during indexing, which would drastically increase the indexing time. Searching works in bundle's text files not requiring decompilation, like bundle manifest files, XML, JSON, and so on.

If you meant something else, please clarify.

royteeuwen commented 3 months ago

@karollewandowski I thought it was possible with normal maven dependencies because I already did this in the past, but I found out that indeed it only works if you actually clicked on the "Download sources" for the external library. Sorry for the confusion! So implementing https://github.com/aemide/issue-tracker/issues/7 might already immediately solve this for all libraries that have sources.

But yes, what you are describing is what I implemented in the past :). Before aem-ide existed, I created this: https://github.com/orbinson/felix-bundle-extractor

In here, I point to the felix directory, and then created a directory with all sources jars:

See https://github.com/orbinson/felix-bundle-extractor/blob/develop/src/main/java/be/orbinson/felix/bundle/extractor/BundleExtractor.java#L308

I then implemented a very simple cli to grep in the sources jar folder for specific strings: https://github.com/orbinson/felix-bundle-extractor/blob/develop/grep-in-jars.sh

I still use this method at this moment, when I'm searching for a string but I don't know in which bundle / class its implemented (for example a servlet path or a resource type), so I was checking if I could deprecate my project completely with this and the other ticket ;)

karollewandowski commented 2 months ago

Hi Roy, I tried to implement it together with #7, but unfortunately, it turned out to be harder than I expected. Decompiling JARs and attaching such sources is trivial, but after that, debugging stops working.

When classes are decompiled directly in the editor by the IDE, the debugger works correctly and can step over the lines. When decompiled class sources are attached, the debugger can't match the executed lines to the decompiled source lines, which is a no-go.

I'll try to somehow solve it, but it needs to wait.

royteeuwen commented 2 months ago

darnit 😄 ! No connections in the Intellij IDEA core team to get that fixed ;)?

karollewandowski commented 4 weeks ago

Update: the debugging problem has been solved, and we are on track to deliver this.

karollewandowski commented 4 days ago

Hi, the initial implementation has been released to the EAP channel. Please update the plugin, test it, and provide feedback.

royteeuwen commented 4 days ago

On first sight this seems to work for both decompiled and sources jars!

A jar with sources:

Screenshot 2024-11-13 at 19 02 06

A jar from decompiled:

Screenshot 2024-11-13 at 19 02 53