Bug 571317 - No code mining updated when using Ctrl+End (was: CodeMiningTest are failing on Windows and Mac)
Summary: No code mining updated when using Ctrl+End (was: CodeMiningTest are failing o...
Status: RESOLVED MOVED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.19   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.23   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 545006
  Show dependency tree
 
Reported: 2021-02-19 00:00 EST by Kalyan Prasad Tatavarthi CLA
Modified: 2022-06-02 01:21 EDT (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 Kalyan Prasad Tatavarthi CLA 2021-02-19 00:00:08 EST
The JFace text tests in org.eclipse.jface.text.tests.codemining.CodeMiningTest  fail in the nightly build as below

Windows

1) testCodeMiningCtrlEnd
2) testCodeMiningCtrlHome
3) testCodeMiningFirstLine

Mac

1) testCodeMiningFirstLine
Comment 1 Kalyan Prasad Tatavarthi CLA 2021-02-19 00:00:27 EST
The link to the test failure report is https://download.eclipse.org/eclipse/downloads/drops4/I20210217-1800/testResults.php
Comment 2 Kalyan Prasad Tatavarthi CLA 2021-02-25 06:43:53 EST
Failed in the IBuild I20210224-1800

https://download.eclipse.org/eclipse/downloads/drops4/I20210224-1800/testResults.php
Comment 3 Kalyan Prasad Tatavarthi CLA 2021-03-02 01:59:29 EST
Please feel free to move the Target Milestone to 4.19 RC2 if you plan to fix it for 4.19.
Comment 4 Kalyan Prasad Tatavarthi CLA 2021-04-08 07:39:12 EDT
In the build I20210407-1800, the below tests failed on Mac and Windows 

Windows

1) testCodeMiningCtrlEnd
2) testCodeMiningCtrlHome
3) testCodeMiningFirstLine

Mac

1) testCodeMiningFirstLine

The link for the tests report is below
https://download.eclipse.org/eclipse/downloads/drops4/I20210407-1800/testResults.php
Comment 5 Kalyan Prasad Tatavarthi CLA 2021-05-20 11:24:45 EDT
In the build I20210519-1800, the below tests failed on Mac and Windows 

Windows

1) testCodeMiningCtrlEnd
2) testCodeMiningCtrlHome
3) testCodeMiningFirstLine

Mac

1) testCodeMiningFirstLine

The link for the tests report is below
https://download.eclipse.org/eclipse/downloads/drops4/I20210519-1800/testResults.php
Comment 6 Kalyan Prasad Tatavarthi CLA 2021-05-27 12:51:31 EDT
In the build I20210526-2310, the below tests failed on Mac and Windows 

Windows

1) testCodeMiningCtrlEnd
2) testCodeMiningCtrlHome
3) testCodeMiningFirstLine

Mac

1) testCodeMiningFirstLine

The link for the tests report is below
https://download.eclipse.org/eclipse/downloads/drops4/I20210526-2310/testResults.php
Comment 7 Kalyan Prasad Tatavarthi CLA 2021-06-03 14:32:30 EDT
In the build I20210603-0040, the below tests failed on Mac and Windows 

Windows

Windows

1) testCodeMiningCtrlEnd
2) testCodeMiningCtrlHome
3) testCodeMiningFirstLine

Mac

1) testCodeMiningFirstLine

The link for the tests report is below
https://download.eclipse.org/eclipse/downloads/drops4/I20210603-0040/testResults.php
Comment 8 Kalyan Prasad Tatavarthi CLA 2021-06-04 00:56:35 EDT
Mass move out of 4.20
Comment 9 Kalyan Prasad Tatavarthi CLA 2021-07-08 06:36:55 EDT
In the build I20210707-1800, the below tests failed on Mac and Windows 

Windows

Windows

1) testCodeMiningCtrlEnd
2) testCodeMiningCtrlHome
3) testCodeMiningFirstLine

Mac

1) testCodeMiningFirstLine

The link for the tests report is below
https://download.eclipse.org/eclipse/downloads/drops4/I20210707-1800/testResults.php
Comment 10 Andrey Loskutov CLA 2021-08-16 14:00:15 EDT
Actually not the tests were guilty!, the code is not working, at least on Windows.

The issue in bug 541415 comment 14 can still be reproduced on Windows!

Because of that, tests fail.

*Exact* these steps from Dani aren't working (enable ALL code minings in Java -> Editor -> Code Mining, and have org.eclipse.jface.text project in the workspace):

#####################################
1. Use Open Type to open TextViewer
2. Wait until the code minings are visible (also the one above class TextViewer
   This takes about 5s
2. Press Ctrl+End
==> no code minings

When I now click somewhere, the minings appear.
#####################################

And the test is also hangs around and fails with assertion except I click somewhere inside the opened text widget during test.
Comment 11 Kalyan Prasad Tatavarthi CLA 2021-11-19 01:05:40 EST
Mass move out of 4.22
Comment 12 Kalyan Prasad Tatavarthi CLA 2022-01-07 00:14:13 EST
In the build I20220106-0000, the below tests failed on Windows 

1. CodeMiningProjectionViewerTest.testCodeMiningDoesntAlterFocus
2. CodeMiningTest.testCodeMiningCtrlEnd
3. CodeMiningTest.testCodeMiningCtrlHome
4. CodeMiningTest.testCodeMiningFirstLine
Comment 13 Mickael Istria CLA 2022-01-07 04:38:26 EST
I'm unfortunately not able to debug at all on Mac, and hardly able to debug on Windows for some time (need to reset a VM and so on and have a lot of higher important stuff in the backlog). Any help is welcome!
Comment 14 Andrey Loskutov CLA 2022-01-07 10:10:26 EST
(In reply to Andrey Loskutov from comment #10)
> Actually not the tests were guilty!, the code is not working, at least on
> Windows.
> 
> The issue in bug 541415 comment 14 can still be reproduced on Windows!
> 
> Because of that, tests fail.
> 
> *Exact* these steps from Dani aren't working (enable ALL code minings in
> Java -> Editor -> Code Mining, and have org.eclipse.jface.text project in
> the workspace):
> 
> #####################################
> 1. Use Open Type to open TextViewer
> 2. Wait until the code minings are visible (also the one above class
> TextViewer
>    This takes about 5s
> 2. Press Ctrl+End
> ==> no code minings
> 
> When I now click somewhere, the minings appear.
> #####################################
> 
> And the test is also hangs around and fails with assertion except I click
> somewhere inside the opened text widget during test.

I've checked a bit deeper.

Bug 541415 comment 20 linked to a very interesting observation made by Eric, in https://www.eclipse.org/lists/platform-dev/msg01475.html he said:

##########
I am dealing with an issue where StyledText is not sending SWT.Selection events when doing selecting text in a certain way while using the Eclipse Java editor. Specifically, StyledText.sendSelectionEvent() is not being triggered.

For example:
1) Open any Java file in the IDE
2) Press Ctrl + Home
3) Press Shift + End

This will select an entire line, but StyledText.sendSelectionEvent() is not called. If I hit the down arrow (moving the caret one line down and clearing the selection), I see the method being called. But doing Shift + End on any line is not triggering it at all.
##########

In fact, the Shift+End is not "seen" by StyledText *inside Java editor*, even more, there is NO "key down" event received at all (!!!) by org.eclipse.swt.custom.StyledText.handleKeyDown(Event).

At same time, this is very well working in a plain Shell - use Snippet25 with this patch: 
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.java
index 1dd67cd..7afafa1 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.java
@@ -24,2 +24,3 @@
 import org.eclipse.swt.*;
+import org.eclipse.swt.custom.*;
 import org.eclipse.swt.layout.*;
@@ -145,4 +146,4 @@
 	};
-	shell.addListener (SWT.KeyDown, listener);
-	shell.addListener (SWT.KeyUp, listener);
+//	shell.addListener (SWT.KeyDown, listener);
+//	shell.addListener (SWT.KeyUp, listener);
 	shell.setLayout(new FillLayout());
@@ -151,2 +152,5 @@
 	label.setText("Start typing to see key state, code and character in console.");
+	StyledText text = new StyledText(shell, 0);
+	text.addListener (SWT.KeyDown, listener);
+	text.addListener (SWT.KeyUp, listener);
 	shell.open ();

This means, somewhere between StyledText and org.eclipse.ui.editors.text.TextEditor the key down event for "SWT.End" key is actively filtered out.

Once we can find the code that filters that out, we can fix Code Minings on Windows (and tests).
Comment 15 Andrey Loskutov CLA 2022-01-07 11:20:13 EST
(In reply to Andrey Loskutov from comment #14)
> This means, somewhere between StyledText and
> org.eclipse.ui.editors.text.TextEditor the key down event for "SWT.End" key
> is actively filtered out.
> 
> Once we can find the code that filters that out, we can fix Code Minings on
> Windows (and tests).

The event is filtered by "org.eclipse.ui.edit.text.select.lineEnd" command that is bound to the "Shift+End" shortcut 
stack:
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:578)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:647)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:439)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1280)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1059)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1084)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1069)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1111)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1107)
	at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1792)
	at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:5162)
	at org.eclipse.swt.widgets.Canvas.WM_KEYDOWN(Canvas.java:406)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4785)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5002)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3630)

This patch fixes the issue from bug 541415 comment 14, but doesn't fix tests (???):

diff --git a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java
index a7dae34..64e882a 100644
--- a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java
+++ b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java
@@ -132,3 +132,3 @@
 		try {
-			outOfOrderKeys = KeySequence.getInstance("ESC DEL"); //$NON-NLS-1$
+			outOfOrderKeys = KeySequence.getInstance("ESC DEL CTRL+END CTRL+HOME"); //$NON-NLS-1$
 		} catch (ParseException e) {

Probably tests have other problem. As I've mentioned already, once the test starts to hang, it is enough to click inside the StyledText to "fix" the hang.
Comment 16 Kalyan Prasad Tatavarthi CLA 2022-02-25 00:15:09 EST
The below tests fail on windows in the build I20220223-1800

1) testCodeMiningDoesntAlterFocus
2) testCodeMiningCtrlEnd
3) testCodeMiningCtrlHome
4) testCodeMiningFirstLine

https://download.eclipse.org/eclipse/downloads/drops4/I20220223-1800/testresults/html/org.eclipse.jface.text.tests_ep423I-unit-win32-java11_win32.win32.x86_64_11.html
Comment 17 Kalyan Prasad Tatavarthi CLA 2022-03-03 12:05:47 EST
The below tests fail on windows in the build I20220302-1800

1) testCodeMiningDoesntAlterFocus
2) testCodeMiningCtrlEnd
3) testCodeMiningCtrlHome
4) testCodeMiningFirstLine

https://download.eclipse.org/eclipse/downloads/drops4/I20220302-1800/testresults/html/org.eclipse.jface.text.tests_ep423I-unit-win32-java11_win32.win32.x86_64_11.html
Comment 18 Kalyan Prasad Tatavarthi CLA 2022-05-20 00:51:57 EDT
The below tests fail on windows in the build I20220519-0130

1) testCodeMiningDoesntAlterFocus
2) testCodeMiningCtrlEnd
3) testCodeMiningCtrlHome
4) testCodeMiningFirstLine

https://download.eclipse.org/eclipse/downloads/drops4/I20220519-0130/testresults/html/org.eclipse.jface.text.tests_ep424I-unit-win32-java11_win32.win32.x86_64_11.html
Comment 19 Kalyan Prasad Tatavarthi CLA 2022-05-27 01:40:29 EDT
The below tests fail on windows in the build I20220525-1800

1) testCodeMiningDoesntAlterFocus
2) testCodeMiningCtrlEnd
3) testCodeMiningCtrlHome
4) testCodeMiningFirstLine

https://download.eclipse.org/eclipse/downloads/drops4/I20220525-1800/testresults/html/org.eclipse.jface.text.tests_ep424I-unit-win32-java11_win32.win32.x86_64_11.html
Comment 20 Kalyan Prasad Tatavarthi CLA 2022-06-02 01:21:52 EDT
Moved to https://github.com/eclipse-platform/eclipse.platform.text/issues/34