NEW DATE! Bugzilla will undergo maintenance 2024-03-28 18h00 CET. Bugzilla will be placed in read-only mode at that time.

Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 484858 - [AQL] Completion after metamodel prefix adds a 2nd prefix
Summary: [AQL] Completion after metamodel prefix adds a 2nd prefix
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 6.0.0   Edit
Assignee: Laurent Fasani CLA
QA Contact: Florian Barbin CLA
URL:
Whiteboard: backport
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-12-23 09:22 EST by Etienne Juliot CLA
Modified: 2018-06-27 11:55 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Etienne Juliot CLA 2015-12-23 09:22:08 EST
steps to reproduce:
- with basicfamily, on Man, write "aql:self.oclAsType(basicfamily::)"
- select basicfamily::Man
- the completion creates "aql:self.oclAsType(basicfamily::basicfamily::Man)" which is invalidated

It should not re-add the MM prefix.
Comment 1 Esteban DUGUEPEROUX CLA 2015-12-28 10:02:57 EST
I confirm the bug, I have had the same through https://bugs.eclipse.org/bugs/show_bug.cgi?id=484217#c4
Comment 2 Yvan Lussaud CLA 2016-05-31 09:06:07 EDT
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=479826#c2
Comment 3 Laurent Fasani CLA 2018-01-05 11:18:11 EST
At a first sight, the fix seems trivial. 
Just provide a proposal that complete what the user has already written:
String proposal = propFromAQL.getProposal().substring(completionResult.getReplacementLength());

For example aql:self.eAllContents(basicfamily::P+CTRL+SPACE -> proposal=erson

But, why have not we got the issue for method completion? aql:self.eAllC+CTRL+SPACE

Because, there is a post processing in TextContentProposalProvider.getProposals(String, int) to convert sirius proposal into Jface. The process is not specific to a particular interpreter. It cuts the proposal according to what users has already written (String proposalStart = new ContentContextHelper(contents, position, prefix).getProposalStart()).

proposal1:
* update TextContentProposalProvider.getProposalStart()to better understand how to cut the proposal.
proposal2:
* update AQLProposalProvider.getProposals(ExpressionTrimmer, int, IQueryEnvironment, Map<String, Set<IType>>) to let the specific interpreter cut the proposal himself.
Comment 4 Eclipse Genie CLA 2018-01-05 12:33:34 EST
New Gerrit change created: https://git.eclipse.org/r/115004
Comment 6 Laurent Fasani CLA 2018-01-30 11:57:28 EST
Steps to validate:
* Create a VSP
* In the odesign, create a diagramDescription and a node mapping
* In an expression, type "aql:self.eAllContents(ecore::EAtt)", position cursor after EAtt and call the completion then select ecore::EAttribute
=>The resulting expression shoulb be "aql:self.eAllContents(ecore::EAttribute)".
Comment 7 Laurent Redor CLA 2018-06-27 11:55:50 EDT
Available in Sirius 6.0.0, see https://wiki.eclipse.org/Sirius/6.0.0 for details