Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 479826

Summary: aql: completion don't find the metamodel elements
Product: [Modeling] Sirius Reporter: Laurent Fasani <laurent.fasani>
Component: CoreAssignee: Laurent Fasani <laurent.fasani>
Status: CLOSED FIXED QA Contact: Florian Barbin <florian.barbin>
Severity: normal    
Priority: P3 CC: florian.barbin, laurent.fasani, laurent.goubet, laurent.redor, maxime.porhel, pierre-charles.david
Version: 3.0.0Keywords: triaged
Target Milestone: 6.0.0   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/59353
https://git.eclipse.org/c/acceleo/org.eclipse.acceleo.git/commit/?id=cb06c757822c5f49035d9476b59d509efbc8aa86
https://git.eclipse.org/r/115005
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=70dab79adbd89cf39bcd12286a7e4e5b466dd3c1
Whiteboard:
Bug Depends on: 529808    
Bug Blocks: 470460    

Description Laurent Fasani CLA 2015-10-15 04:05:37 EDT
Scenario:
* In a odesign, create a diagram and a node mapping
* In an expression, type "aql:self.eAllContents()"
* Put the cursor between parenthesis and call completion
=>issue1 : nothing is displayed
If we write, as prefix, the metamodel name followed by ::, the metamodel elements are displayed
* call the completion after "<metamodel name>::"
=>issue2 : once the user has selected something the result is that "<metamodel name>::" is displayed twice in the expression field
Comment 1 Eclipse Genie CLA 2015-10-30 10:25:02 EDT
New Gerrit change created: https://git.eclipse.org/r/59353
Comment 2 Laurent Goubet CLA 2015-10-30 12:04:31 EDT
The first part of this bug (completion within self.eAllContents()) is a duplicate of bug 465037.

The second part (completion not replacing the existing "ecore::" when accepting a proposal) is due to AQL not sending accurate replacement info back to the proposal users.

Gerrit https://git.eclipse.org/r/59353 introduces APIs to feed back said info. Sirius will need to exploit it.

Only two lines need to be changed, in org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.getProposals(ExpressionTrimmer, int, IQueryEnvironment, Map<String, Set<IType>>)

Replace

int offset = position - completionResult.getPrefix().length();
int length = completionResult.getPrefix().length() + completionResult.getRemaining().length();

with

int offset = trimmer.getPositionInExpression(completionResult.getReplacementOffset());
int length = completionResult.getReplacementLength();

once our patch is pushed on master
Comment 4 Laurent Fasani CLA 2018-01-05 12:26:37 EST
the first issue described in #comment1 is handled by bug 484858
This ticket will handle the second issue.

Scenario:
* In a odesign, create a diagram and a node mapping
* In an expression, type "aql:self.eAllContents(ecore::)"
* call the completion after "ecore::"
=>issue2 : once the user has selected something the result is that "ecore::" is displayed twice in the expression field
Comment 5 Eclipse Genie CLA 2018-01-05 12:33:36 EST
New Gerrit change created: https://git.eclipse.org/r/115005
Comment 6 Laurent Fasani CLA 2018-01-05 12:51:19 EST
ERRATUM: the #comment4 is wrong

the second issue described in #comment1 is handled by bug 484858
This ticket will handle the first issue but with a slightly different scenario.

Scenario:
* In a odesign, create a diagram and a node mapping
* In an expression, type "aql:self.eAllContents()"
* Put the cursor between parenthesis and call completion
=>issue1 : all types of all meta-model found (sirius and domain meta-models registered as representationDescription metamodels) are listed. The result is huge and not pertinent
* Type "aql:self.eAllContents(eco)", position cursor after eco and call the completion
=>issue3 : nothing is displayed as proposals. All ecore::xxtypes should be proposed.
Comment 8 Laurent Fasani CLA 2018-01-30 11:50:06 EST
Steps to validate:
* Create a VSP
* In the odesign, create a diagramDescription and a node mapping
* In an expression, type "aql:self.eAllContents(eco)", position cursor after eco and call the completion
=>All ecore::xxtypes should be proposed.
Comment 9 Laurent Redor CLA 2018-06-27 11:55:26 EDT
Available in Sirius 6.0.0, see https://wiki.eclipse.org/Sirius/6.0.0 for details