Bug 572806 - Support Ctrl-Click for Java stack trace type output
Summary: Support Ctrl-Click for Java stack trace type output
Status: ASSIGNED
Alias: None
Product: CDT
Classification: Tools
Component: terminal (show other bugs)
Version: Next   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jonah Graham CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on: 563015
Blocks:
  Show dependency tree
 
Reported: 2021-04-13 09:35 EDT by Jonah Graham CLA
Modified: 2021-11-15 12:27 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonah Graham CLA 2021-04-13 09:35:24 EDT
Bug 563015 added Ctrl-Click support for the terminal. There are other common output formats that should be supported. High on that list is Java Stack Traces.

See some commentary in Bug 563015 Comment 6
Comment 1 Jonah Graham CLA 2021-04-13 09:44:25 EDT
I think we should see if we can support consolePatternMatcherListeners[1] extension point here. 

[1]https://help.eclipse.org/2021-03/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_console_consolePatternMatchListeners.html
Comment 2 Jonah Graham CLA 2021-04-13 09:52:28 EDT
The Java stacktrace parser for consoles is contributed in org.eclipse.jdt.debug.ui - it is only enabled under some conditions. For example, if you do an external launch with java as the executable it is enabled, but if the executable is bash it won't be enabled.
Comment 3 Eclipse Genie CLA 2021-04-13 11:14:50 EDT
New Gerrit change created: https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/179257
Comment 4 Jonah Graham CLA 2021-04-13 11:20:46 EDT
I created a proof of concept of using consolePatternMatcherListeners and it worked fairly well. It is a little spaghetti at the moment because we have to "look" like a Console to the consolePatternMatcherListeners, but it looks pretty good.

My decision in the first phase was to use consolePatternMatcherListeners after the user clicks on a word, rather than to identify all hyperlinks ahead of time.

I don't know if that was correct, and if perhaps what should happen is the consolePatternMatcherListeners is used to identify where hyperlinks could be in the document in the first place - which is what the Console view does. I don't think we should identify all hyperlinks ahead of time though and limit the search to what is being hovered.

However, the console view does the hyperlink searching off the UI thread and ahead of time. That may mean that existing consolePatternMatcherListeners are too slow to be run at hover time as that means running in the UI thread.
Comment 5 Fabrizio Iannetti CLA 2021-04-24 06:00:05 EDT
One possible option is to take a snapshot of the console content (possibly limited to a certain amount of lines before/after the current screen) when the user presses Ctrl and start a thread to do the search on that snapshot (one could even run each contributor in parallel using a thread pool, but that may probably be overkill)

Then, from the UI side I see two options:

1. wait for a result from the thread with a timeout, if exceeded the parsing is aborted.
2. provide the hover selection asynchronously, invalidating it if in the meantime the console content has changed.

What do you think?

I will give it a shot by running the current basic detector in a worker thread and see how it goes.
Comment 6 Jonah Graham CLA 2021-04-24 23:39:17 EDT
I think that is a good idea. The detection actually looks pretty fast if done a line at a time (how long can a few regexes take run in a separate thread?). 

One of the drawbacks to my PoC is that it didn't pay attention to enablements, as a result for some items there are many hits. May want a popup like the hyperlink detector has in the editor?
Comment 7 Jonah Graham CLA 2021-05-27 01:41:31 EDT
There were a lot of other higher priority Terminal bugs & features that got addressed, unfortunately that has bumped this to another release.
Comment 8 Jonah Graham CLA 2021-09-15 10:32:41 EDT
(Sorry - Covid summer used up too much of my time and these items did not make it into CDT 10.4. Retargetting for 10.5)
Comment 9 Jonah Graham CLA 2021-11-15 12:27:27 EST
I am working on this in the background - but not sure which version of CDT I will get this resolved in.