Bug 569016

Summary: [content assist] should be able to correct spelling mistakes
Product: [Eclipse Project] JDT Reporter: Wim Jongman <wim.jongman>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: mistria, rgrunber
Version: 4.18Keywords: needinfo
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Example none

Description Wim Jongman CLA 2020-11-21 06:30:26 EST
Created attachment 284833 [details]
Example

A misspelled parameter cannot be fixed with content assist.
Comment 1 Roland Grunberg CLA 2020-12-09 14:14:42 EST
Version: 2020-12 (4.18)
Build id: I20201130-1800

I'm actually not able to reproduce this. In my case, JDT proposes quick fixes like 'Change to Object' or 'Change to object', depennding on whether I have misspelled a Type or identifier.

I've even tried misspelling parameter names but the suggestions come up as expected.

Relevant code would appear to be in UnresolvedElementsSubProcessor#addSimilar{Type,Variable}Proposals(..) . For variables, it gets all within scope and compares similarity to the unresolved variable.

Are you able to reproduce in a fresh workspace with a recent Eclipse ?
Comment 2 Mickael Istria CLA 2021-01-11 15:28:56 EST
(In reply to Wim Jongman from comment #0)
> A misspelled parameter cannot be fixed with content assist.

This specific case might be doable by hacking the existing Java content assist processor so it can provide good proposals in case none properly match prefix but some "main" proposals are not too far in distance to the prefix.

I like the idea of trying to generally hook quick-fixes into content-assist (basically merging Ctrl+1 into Ctrl+Space). That could basically apply to all editors. However the tricky part is about what to give priority and show first? I guess while user is actively typing, content-assist proposals are to be preferred over quickfixes, and when "pausing" quick-fixes may be more interesting. But how can we really know the difference between both case reliably?
In any case, if this is what you have in mind, please open a separate ticket as this one is a specific instance; which can have alternative solutions.