Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Async Code Completion Requests in Eclipse Platform

> Any thoughts on using a reactive stream to collect completion items?  

If we were to build any new API for this it may make sense to use reactive streams. Actually displaying the results incrementally could be a challenge since you'd want to avoid moving any items around as the user is trying to click on/select them... but building an implementation backed by reactive streams would let us add this sort of incremental insertion at a later time without having to change the back-end. That's nice from a future-proofing perspective. I'm not suggesting we toss everything and do a fully reactive stream-based implementation, but it would be good to keep an eye out for opportunities to use reactive streams at interface while we're doing this work.

  - Stefan

On Fri, Nov 11, 2016 at 8:28 AM Daniel Megert <daniel_megert@xxxxxxxxxx> wrote:
Hi Matthias

I did not have time yet to digest your e-mail but wanted to give a quick answer to one of your questions:

> What were your attempts and ideas when trying to implement asynchronous code completion in Eclipse?
See https://bugs.eclipse.org/251156for discussions and concerns.

Dani



From:        "Becker, Matthias" <ma.becker@xxxxxxx>
To:        "platform-ui-dev@xxxxxxxxxxx" <platform-ui-dev@xxxxxxxxxxx>
Date:        11.11.2016 11:56
Subject:        [platform-ui-dev] Async Code Completion Requests in Eclipse Platform
Sent by:        platform-ui-dev-bounces@xxxxxxxxxxx




Dear Platform UI Devs,
 
this is Matthias from SAP. I had a discussion with Mickael Istria on Eclipse Con Europe. In the context of the language server protocol Mickael showed big interest in SAPs Implementation of asynchronous Code Completion used in the ABAP Development Tools ( a closed source product based on the Eclipse Platform) as the Eclipse Platform is lacking this.
 
I now had the time to have a look into the source code to check if it might be possible to contribute it. Unfortunately, the implementation mixes other ABAP-specific aspects with the aspect of the asynchronous execution. I would say it’s almost impossible / only possible with huge effort to separate these aspects. In addition, the ABAP Development Tools would not benefit from this effort because the problem is solved for the ABAP Development Tools and refactoring in this complex but very stable code would introduce new bugs into the code base. I don’t see any arguments that I could use to justify this big effort towards our management. Sorry for that.
 
But even when we cannot contribute our implementation Eclipse may benefit from our experience. Maybe we could come into a discussion about the concepts and pitfalls and maybe everybody can benefit in the one or the other way.
 
I created an UML sequence diagram (download link at the end) that visualizes the control and data flow that takes place when a user triggers code completion in the ABAP-Editor. The sequence diagram is simplified and it only shows the aspect of the asynchronous execution. I have attached it also to this mail.
 

 
We could not change an Eclipse APIs so this was our approach:
 
We implemented our own IContentAssistant and IContentAssitProcessor classes. The idea is to start a Job in the content assist processor. The call to „computeCompletionProposals()” returns a „pseudo“ result that shows a „Loading code completion results ..:“ Text in the completion popup.
In the job we send a HTTP request to our server and get the list of possible completions. As soon the response arrived we „park“ these results in the content assist process instance and trigger the code completion again by calling „doOperation()“ on the source viewer instance via display.asyncExec(). This second call then detects that we have parked results from the previous call does not schedule the job again but just takes the parked results.
 
What we don’t see here is the complete UI handling. In the second „doOperation“ you have get hold on the open completion popup, have to remove the „Loading...“ entry and show the actual completions. The user might have closed the completion popup (via pressing Esc) while the job is running. In these cases, we have to ensure that we don’t store the results of the job (as they would be displayed on the next code completion request that might be on a completely different location in the editor). You have to ensure that you don’t run into trouble with race conditions.
 
We use a similar approach when calculation quick fix proposals as this is also only possible on the server side.
 
I made a short screen recording (download link at the end) where you can see this in action. I slowed down the network communication so that you can see „Loading...“ text – with „normal“ Networking latency inside a corporate LAN you hardly can see this. In my first code completion request you see the „Loading...“ text and at the bottom of the screen you can see the network communication in the „ABAP Communication Log“ view. In my second request I pressed „Esc“ while the network request was running. You see that the popup is closed - the network request cannot be canceled but the response of it is simply discarded when it arrives.
 
At least this second call to „doOperation()“ out of the job is from my point of view very very ugly. This should be implemented differently when you have the possibility to enhance Eclipse APIs.
 
What were your attempts and ideas when trying to implement asynchronous code completion in Eclipse?
 
Do you plan to enhance other APIs in the platform to better support asynchronous flows?
 
Download Link: https://mdocs.sap.com/mcm/public/v1/open?shr=0R8U0xM3jYqwLofv3OuTe3EfsYEv0HhNvyGeLDoJKdU
 
Regards,
Matthias
 
Matthias Becker
Development, PI Tech Core ABAP Server (SE)
SAP SE, Dietmar-Hopp-Allee 16, 69190 Walldorf, Germany
 
T +49 6227 7-60223, M +49 151 53858523, E ma.becker@xxxxxxx
 
Mandatory Disclosure Statement:
http://www.sap.com/company/legal/impressum.epx/
 
This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.[attachment "image001.png" deleted by Daniel Megert/Zurich/IBM] _______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev


_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev

Back to the top