Community
Participate
Working Groups
When using the content proposal API to create content assist, the assist is only activated on the second key stroke. In RCP it reacts to the first char. That might be related to the fieldassist API.
Created attachment 189272 [details] Entry point to reproduce it
The actual problem is the wrong (different from RCP) value of "position" parameter of IContentProposalProvider#getProposals method. When you type the first character, the "position" parameter is 1 in RCP, but 0 in RAP. The attached snippet returns empty array with proposals if "position" is 0. ContentProposalAdapter is heavy use Key Events. The proposals shell is auto activated on KeyDown event if autoActivationCharacters are set or on Modify Event if they are not set. Because key events are fired before setting the text caret position we get wrong (previous) caret position. For now, the workaround is to *NOT* set the autoActivationCharacters.
Fixed in CVS HEAD. The more general underlying problem was that key events are send before they are processed by the client, so widgets influenced by the key event dont have a chance to update. Fixed by sending the request asynchronously (i.e. with a timeout of 0 ms). My reasearch showed that even if the timer is started on keydown, it wont trigger until after the following keypress event.