Bug 479826 - aql: completion don't find the metamodel elements
Summary: aql: completion don't find the metamodel elements
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 6.0.0   Edit
Assignee: Laurent Fasani CLA
QA Contact: Florian Barbin CLA
URL:
Whiteboard:
Keywords: triaged
Depends on: 529808
Blocks: 470460
  Show dependency tree
 
Reported: 2015-10-15 04:05 EDT by Laurent Fasani CLA
Modified: 2018-06-27 11:55 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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