Bug 568844 - [code mining] Make method parameter annotations less "jumpy"
Summary: [code mining] Make method parameter annotations less "jumpy"
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.18   Edit
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-16 07:39 EST by Juergen Baier CLA
Modified: 2022-12-22 19:32 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 Juergen Baier CLA 2020-11-16 07:39:33 EST
The code mining "method parameter names" often leads to changing layout in the editor which is annoying when this happens while you are typing.

Consider the following code:

@Test
public void someTest() {
  assertEquals("some text", 2, List.of("x").size());
}

This is shown like below when the method parameter annotations are active:

@Test
public void someTest() {
  assertEquals(message: "some text", expected: 2, actual: List.of("x").size());
}


Now I want to change the "2" in the code above to "1".

- Place the cursor right of the "2"
- Delete the "2"

=> 

- First the editor changes to:

@Test
public void someTest() {
  assertEquals(message: "some text", , actual: List.of("x").size());
}

- Then (after maybe half a second) the editor changes to:


@Test
public void someTest() {
  assertEquals("some text", , List.of("x").size());
}

- Then I type "1" and the editor changes to

@Test
public void someTest() {
  assertEquals(message: "some text", expected: 1, actual: List.of("x").size());
}


This really is annoying - in particular when you look at a specific place in the editor to type something and suddenly the position changes. In the example above the cursor position changes 3 times.

What I want is:

@Test
public void someTest() {
  assertEquals(message: "some text", expected: 2, actual: List.of("x").size());
}


- Delete "2". Editor still shows all annotations:

@Test
public void someTest() {
  assertEquals(message: "some text", expected: , actual: List.of("x").size());
}

- Type "1". Editor still shows:

@Test
public void someTest() {
  assertEquals(message: "some text", expected: 1, actual: List.of("x").size());
}

=> Nothing jumps around, the user can always keep typing at the same screen position.
Comment 1 Mickael Istria CLA 2020-11-17 01:17:04 EST
This is mostly caised by the face that when a parameter is missing, the code mining implementation fails at resolving which method is used, and then fails at resolving the parameter names.
One way I imagine to improve that is that in case no.method os found, we find a way to get access to some "candidates" that match the number of parameters and the.type of known ones, and if there is only one or of all candidates have same parameter names, we use them. That would avoid the disappearance/reappearance as use types.
Comment 2 Roland Grunberg CLA 2020-12-09 10:32:02 EST
*** Bug 569124 has been marked as a duplicate of this bug. ***
Comment 3 Roland Grunberg CLA 2020-12-09 10:34:24 EST
(In reply to Roland Grunberg from comment #2)
> *** Bug 569124 has been marked as a duplicate of this bug. ***

While parameter names changing from unresolved/resolved cause jumps horizontally, the bug I just closed as duplicate mentions the case of annotation loading causing line positioning to change vertically.

Both essentially point to code mining annotations interfering with when a user wishes to perform some action but for different reasons.
Comment 4 Eclipse Genie CLA 2022-12-22 19:32:36 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.