Bug 541580 - [content assist] when class has a missing field/method, make it a proposal when CA is invoked in class body
Summary: [content assist] when class has a missing field/method, make it a proposal wh...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.10   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2018-11-27 03:25 EST by Mickael Istria CLA
Modified: 2018-11-27 10:35 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mickael Istria CLA 2018-11-27 03:25:37 EST
I'm writing a piece of code with a non-existing (yet) method. The missing method is marked as error and a quick-fix is available. But I've got stuff to copy paste and prefer not using the automated createMethod quick-fix. So I get just after my current method and start typing the missing method signature, without much assistance.
In this case, the CA processor could check that a method is missing in the class (using the marker for instance) and guide me in creating the method signature with similar capabilities as offered by the quick-fix.
Comment 1 Stephan Herrmann CLA 2018-11-27 07:32:22 EST
(In reply to Mickael Istria from comment #0)
> I'm writing a piece of code with a non-existing (yet) method. The missing
> method is marked as error and a quick-fix is available. But I've got stuff
> to copy paste and prefer not using the automated createMethod quick-fix. So
> I get just after my current method and start typing the missing method
> signature, without much assistance.

Frankly, I don't see the advantage of using content assist over quick fix.
How does your approach better support copy-paste than the existing quick fix?

Not that I thinks such content assist would be wrong, just I personally believe we have other feature requests that would create more value than this one ...
Comment 2 Mickael Istria CLA 2018-11-27 08:11:18 EST
(In reply to Stephan Herrmann from comment #1)
> Frankly, I don't see the advantage of using content assist over quick fix.
> How does your approach better support copy-paste than the existing quick fix?

I'm not pretending it's better, it just happens to be what I want to use from time to time, and I'm always disappointed by the Content Assist not being smart for this case.

> I personally
> believe we have other feature requests that would create more value than
> this one ...

Sure, but this kind of low-hanging fruits comfort additions are also making a difference. Compare what people like in IJ vs Eclipse IDE, and they often mention the completion, it can take the form of such small cases which summed together make a big difference. The ROI of such small tasks on user satisfaction can actually be very good.
Comment 3 Dani Megert CLA 2018-11-27 10:28:10 EST
So, maybe what you're really asking for is that Quick Fixes/Assists are also shown when invoking content assist?
Comment 4 Mickael Istria CLA 2018-11-27 10:35:07 EST
(In reply to Dani Megert from comment #3)
> So, maybe what you're really asking for is that Quick Fixes/Assists are also
> shown when invoking content assist?

If we have in quick-fixes/assists a method to declare whether the upcoming change can be applied at a given caret location, why not; but I don't think there is.
From the Class Body where I've moved my cursor, I wouldn't like to see all quick-fixes/assists for all markers in the class file, I'm only interested in those that have for effet to create a new field or method. The logic seems a bit complex to easily map the 2 concepts automatically, but we could image a genric and reusable content-assist processor that could wrap a quick-fix/assist and show it where it makes sense.

Pragmatically, just having a dedicated "MissingFieldsOrMethodContentAssistProcessor" that is only returning results when in a class body according to the missing field/method report seems simpler.