Closed SirWellington closed 5 years ago
I have tried debugging. Unfortunately I can't seem to debug the plugin off AppCode.
I get a whole bunch of compile-time errors when I link it to AppCode's SDK.
Seems to debug just fine from IntelliJ though.
You could setup the SDK from IntelliJ Community, and JRE from AppCode, or comment/remove those classes.
@krasa Just tried your tip. It worked and I was able to debug the plugin.
The GrepCopyingFilterSyncListener.process()
function is only getting called when a grep tab is first opened, and not for subsequent events.
As you can see, none of the new events are picked up in the Grep Tab.
Check if .GrepConsoleInputFilterProvider#getDefaultFilters
is called when you run the app.
Then com.intellij.execution.filters.CompositeInputFilter#applyFilter
and krasa.grepconsole.filter.GrepCopyingFilter#applyFilter
I suspect that com.intellij.execution.impl.ConsoleViewImpl#print(java.lang.String, com.intellij.execution.ui.ConsoleViewContentType)
might be overriden. and not call InputFilters - com.jetbrains.commandInterface.console.CommandConsole
does that.
GrepConsoleInputFilterProvider.getDefaultFilters()
was called.
CompositeInputFilter#applyFilter
was also called. See attached.
The result = filter.applyFilter(text, contentType);
line is returning null for both filters that I am seeing.
Everything looks fine unless there are some other filters in those InputFilterWrappers.
The important thing is that krasa.grepconsole.filter.GrepCopyingFilter#applyFilter
is called, and then you should be able to step through the code and see where it goes wrong - which may be pretty soon if as you say GrepCopyingFilterSyncListener
is not called.
Right. Well it would appear that this function indeed gets called. However the copyingListeners
list is empty, so the function invariably returns null
.
What are your thoughts? Wish I could do more, but you understand this framework far better than I.
Dug some more. Looks like there are multiple GrepCopyingFilter
instances running around. One of them has the listener registered, but the others do not.
The one that is getting called does not have any listeners registered. Do you know why that might be?
The one that has it, should be for the console from which you are grepping.
If not, then perhaps it was unregistered by: https://github.com/krasa/GrepConsole/blob/278a868c810636d6b7f821f5b208b1b3beb9bbf0/src/krasa/grepconsole/grep/OpenGrepConsoleAction.java#L178 Or a wrong instance was used at some point.
@krasa I put on a breakpoint on removeListener()
, and I know that wasn't called. So it must be the other thing.
This is weird. I suspect the AppCode is using a different platform jar which might be breaking tings.
That must mean that hashcode is broken and this does not work https://github.com/krasa/GrepConsole/blob/fe78e7bb8284cba3897a7e999bef3a03cc774663/src/krasa/grepconsole/plugin/ServiceManager.java#L86
* As much as is reasonably practical, the hashCode method defined by
* class {@code Object} does return distinct integers for distinct
* objects. (This is typically implemented by converting the internal
* address of the object into an integer, but this implementation
* technique is not required by the
* Java™ programming language.)
hmm
I temporarily hacked it by setting the copyingListeners
field to static
, and then doing:
public void addListener(GrepCopyingFilterListener copyingListener) {
if (copyingListeners.contains(copyingListener)) return;
copyingListeners.add(copyingListener);
}
@krasa What do you recommend we try next?
I will try to set up a VirtualBox with MacOS and reproduce it.
Try to add this thing: https://github.com/krasa/GrepConsole/commit/08beae1b9284ab465d4eb2a2cb316a2d93d9af8f
I think it is more probable than broken JVM, and I still did not make macOs work.
@krasa So far so good. Looks like that commit did the trick. Thanks.
In reference to #120
Unfortunately, this issue is happening again. I've tried everything I can think of. I will have to try and debug the plugin like you suggested.