Community
Participate
Working Groups
Steps to reproduce: - open the interpreter and select a model element with a structural feature named "name". - type "[self.na/]" and put your cursor between the "a" and the "/" - call the code completion and select "name" - the result will be [self.name/], as expected - now replace the expression with "aql:self.na" - put your cursor after the "a" and select "name" in the code completion - the result will be "aql:naname" (the existing part of the expression has not been replaced) The problem comes from the fact that the Acceleo MTL interpreter can tell Sirius that the proposal "name" should replace some of the existing characters of the expression ("na" in our case). This issue highlight a problem with the bundle org.eclipse.sirius.interpreter which depends on "org.eclipse.acceleo.ide.ui" in order to contribute to the Acceleo interpreter view but using this dependency and a dependency to "org.eclipse.sirius.common.acceleo.mtl.ide", it also provides a preferential treatment to the Acceleo MTL interpreter. Only Acceleo can provide advanced proposals with images for example. This dependency to the Sirius Acceleo MDE IDE bundle is used only to provide better completion proposals to the Acceleo MTL interpreter. The SiriusInterpreterSourceViewer can ask an interpreter to provide ContentProposal (from Sirius Common), yet those content proposals are not powerful enough to indicate that a part of the existing expression should be replaced or to support images. Those basic proposals are then later converted by the Sirius Interpreter bundle into ICompletionProposal (from JFace) which are powerful enough to do the job (in the method computeCompletionProposals of SiriusContentAssistProcessor). Given the fact that the Sirius interpreter API asks for an API which cannot hold the necessary information to do this job, neither the Acceleo MTL interpreter nor the Acceleo AQL one should be able to do the job in our use case but using the dependency to Acceleo 3, the Sirius Interpreter bundle uses an internal class of Acceleo MTL named AcceleoCompletionProposal, which has all the relevant pieces of information, to improve the support for Acceleo MTL. The class org.eclipse.sirius.common.tools.api.contentassist.IProposalProvider asks for Sirius' ContentProposal which can only have: - proposal: String - display: String - information: String - cursorPosition: int While it will try to create JFace's ICompletionProposal which, using the implementation SiriusCompletionProposal, can have: - displayString: String - replacementString: String - replacementOffset: int - replacementLength: int - cursorPosition: int - image: Image - contextInformation: IContextInformation - additionalProposalInfo: String While we could trim the proposal returned by AQL to cover the basic use case highlighted here "aql:self.na", it would not work for more complex use cases like "aql:self.nam" with the cursor between the "a" and the "m". Using the Sirius API, AQL could not indicate that an "e" should be placed after the expression by saying like Acceleo that "nam" should be replaced by "name". Improving the completion proposal API could also let other interpreter improve their code completion proposals (feature:, var:, service:) with better replacement in the origin expression and maybe even images (it could be another bug entry).
New Gerrit change created: https://git.eclipse.org/r/53891
Gerrit change https://git.eclipse.org/r/53891 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=8021528a682e09106ed319866698d3ddfddb3c5f
Fixed by 8021528a682e09106ed319866698d3ddfddb3c5f.
Validated on Sirius 3.1.0.201510130903
Available in Sirius 3.1.0.