Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314313 - [content assist] can not tab between fields after applying JSDT content assist in HTML document
Summary: [content assist] can not tab between fields after applying JSDT content assis...
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: Web (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2 RC4   Edit
Assignee: Ian Tewksbury CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-25 13:28 EDT by Ian Tewksbury CLA
Modified: 2010-06-03 13:42 EDT (History)
4 users (show)

See Also:
david_williams: pmc_approved+
raghunathan.srinivasan: pmc_approved+
thatnitind: pmc_approved? (naci.dai)
thatnitind: pmc_approved? (deboer)
neil.hauge: pmc_approved+
thatnitind: pmc_approved? (kaloyan)
cmjaun: review+
thatnitind: review+


Attachments
Fix Patch (2.91 KB, patch)
2010-05-25 13:37 EDT, Ian Tewksbury CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Tewksbury CLA 2010-05-25 13:28:34 EDT
Currently after invoking content assist in an HTML document in a STYLE element and selecting a JavaScript method with fields the fields are automatically added but there is no tabbing between fields so then the user is forced to manually delete each of the automatically inserted fields so as to insert the correct ones.  Also there is no automatic consumption of the closing parentheses.
Comment 1 Ian Tewksbury CLA 2010-05-25 13:37:02 EDT
Created attachment 169862 [details]
Fix Patch

the problem here is that in JSDTCompletionProsal#apply(ITextViewer, char, int, int) if the wrapped ICompletionProposal is a LazyJavaCompletionProposal then ICompletionProposalExtension#apply(IDocument, char, int) is being called rather then ICompletionProposalExtension2#apply(ITextViewer, char, int, int) and without the viewer then the tabbing fields can not be set up.  The same goes for the closing parenthesis consumption.

Another addition that has to be made is overriding the #getSelection function so as to use the wrapped proposals #getSelection method rather then supers if its apply method was used (thus if its a LazyJavaCompletionProposal).

Seeing as this is all UI improvements I don't have any idea what sort of JUnit would be useful in this situation but adding this scenario to the smoketest would probably be a good idea.
Comment 2 Chris Jaun CLA 2010-06-02 11:27:36 EDT
Let's get this in 3.2.
Comment 3 Nitin Dahyabhai CLA 2010-06-02 20:54:33 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

The applied JS proposal supplies default values for any arguments and assumes that the UI allows for the user to tab through them quickly for corrections or removal.  It fails the expectations of users of the standalone JavaScript editor when working in web pages, but in a way which we can actually address relatively easily.

* Is there a work-around? If so, why do you believe the work-around is insufficient? 

Disable the (enabled by default) "Fill argument names on completion" option in the JavaScript Editor Content Assist preferences, but this would apply to the JS editor as well.

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?

Manual testing.

* Give a brief technical overview. Who has reviewed this fix? 

Updates the proposal class to apply the proposal class using a method that passes in the viewer.

* What is the risk associated with this fix? 

Low.  Only affects JS proposals in web pages.
Comment 4 David Williams CLA 2010-06-02 22:10:34 EDT
I agree this would be "missing function" (albeit small) and it is in an area (JSDT) that we want to highlight this release. Seems safe enough.
Comment 5 Neil Hauge CLA 2010-06-02 22:24:58 EDT
Appears to be low risk.
Comment 6 Nitin Dahyabhai CLA 2010-06-03 12:41:21 EDT
Released into v201006030742.