Bug 428752 - Problem with completion when case is not respected
Summary: Problem with completion when case is not respected
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0.0M5   Edit
Hardware: All All
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks: 529898
  Show dependency tree
 
Reported: 2014-02-21 09:59 EST by Stéphane Thibaudeau CLA
Modified: 2018-08-21 05:42 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Thibaudeau CLA 2014-02-21 09:59:35 EST
For example, on ecore Metamodel.
In an odesign file, enter "[eco/]" and launch auto-completion.
The completion suggests "eContainer()".
Validate this choice, then you should see "[ecoeContainer()/]"

Doing the same thing with "[eCo/]" works as expected : as soon as the characters case is respected the completion works, otherwise the completion appends to the existing characters.
Comment 1 Alex Lagarde CLA 2014-02-21 11:14:17 EST
Reproduced with Sirius M5
Comment 2 Laurent Fasani CLA 2014-11-28 06:00:42 EST
fix submitted on gerrit https://git.eclipse.org/r/#/c/37099/ AND https://git.eclipse.org/r/#/c/37102/
Comment 3 Laurent Fasani CLA 2014-11-28 09:53:50 EST
code generation template : https://gerrit.obeo.fr:8443/941
Comment 4 Laurent Fasani CLA 2014-12-01 04:38:23 EST
update of fix with API modification https://git.eclipse.org/r/37344
Comment 5 Laurent Fasani CLA 2014-12-04 07:04:15 EST
regression detected on class domain completion
do not close this bug
Comment 7 Pierre-Charles David CLA 2015-01-30 03:59:43 EST
Moving to 3.0.0, but this is not a priority given the cost and impact of a correct solution which would avoid the regressions we saw witht the first attempt.
Comment 8 Pierre-Charles David CLA 2015-06-23 10:36:54 EDT
Moving to 4.0: not critical enough compared to the cost and risks of regressions.
Comment 9 Pierre-Charles David CLA 2015-08-27 10:05:08 EDT
The new ContentProposalWithReplacement introduced by https://git.eclipse.org/r/#/c/54689/ for bug #475176 may provide what was needed to finish this.
Comment 10 Pierre-Charles David CLA 2015-12-15 04:11:09 EST
Moving out of the 4.0 scope for now, along with all the other issues which were there "by default". This does not mean some of these will not be re-integrated at some point, but for now these issues are not part of the roadmap for 4.0.

If you feel strongly about this removal from 4.0 and/or are ready to sponsor the corresponding work, feel free to comment.
Comment 11 Yvan Lussaud CLA 2016-09-16 05:38:56 EDT
In order to get proprer information form AQL you can have a look at:

CompletionTest.assertCompletion()

completionResult.getReplacementOffset()
completionResult.getReplacementLength()
Comment 12 Stephane Begaudeau CLA 2016-09-16 05:51:31 EDT
The issue comes from the fact that the Properties view of the odesign file are using an old API for the text widget and its content assist:
org.eclipse.jface.fieldassist.IContentProposal

This API does NOT support the replacement of a part of the existing text contrary to more modern APIs.

The Sirius/AQL bridge is computing CORRECTLY how to replace the text in:
org.eclipse.sirius.common.acceleo.aql.ide.proposal.AQLProposalProvider.getProposals(ExpressionTrimmer, int, IQueryEnvironment, Map<String, Set<IType>>)

Even better, now AQL is providing this information directly in the completion result. None of that matter because as long as the Properties view of the odesign use this old text widget IT CANNOT WORK, EVER :)

Sirius would need to use a SourceViewer backed by a StyledText which can accept an org.eclipse.jface.text.contentassist.IContentAssistant working with an org.eclipse.jface.text.contentassist.IContentAssistProcessor to provide instances of org.eclipse.jface.text.contentassist.ICompletionProposal which can replace the existing content.


tldr: JFace Text ICompletionProposal > JFace FieldAssist IContentProposal
Comment 13 Pierre-Charles David CLA 2016-09-20 03:37:52 EDT
(In reply to Stephane Begaudeau from comment #12)
> The issue comes from the fact that the Properties view of the odesign file
> are using an old API for the text widget and its content assist:
> org.eclipse.jface.fieldassist.IContentProposal
> 
> This API does NOT support the replacement of a part of the existing text
> contrary to more modern APIs.

Stéphane, I seem to remember that you proposed patches to improve this at some point. IIRC we could not accept them at the time because they would have made us depend in EMF 2.10+, while at the time we still needed to be compatible with earlier versions. This wouldn't be an issue anymore now, but I can't find the patches in question. Do you remember about that?
Comment 14 Stephane Begaudeau CLA 2016-09-20 03:50:09 EDT
(In reply to Pierre-Charles David from comment #13)
> (In reply to Stephane Begaudeau from comment #12)
> > The issue comes from the fact that the Properties view of the odesign file
> > are using an old API for the text widget and its content assist:
> > org.eclipse.jface.fieldassist.IContentProposal
> > 
> > This API does NOT support the replacement of a part of the existing text
> > contrary to more modern APIs.
> 
> Stéphane, I seem to remember that you proposed patches to improve this at
> some point. IIRC we could not accept them at the time because they would
> have made us depend in EMF 2.10+, while at the time we still needed to be
> compatible with earlier versions. This wouldn't be an issue anymore now, but
> I can't find the patches in question. Do you remember about that?

You are talking about this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=477963

My patch would improve the feature provided by AQL and the AQL bridge with styled text, better documentation etc. Those features, once integrated in the Sirius AQL Bridge would provide better content assist but only in the Interpreter View because in the text field of the Properties view for the odesign editor this old text API is used. My changes would not work here too for the exact same reasons. For example, in the Properties view of the odesign editor, you can't even have the documentation of the content proposal like in the next screenshot while this feature has been working for months in the Interpreter view.

https://bugs.eclipse.org/bugs/attachment.cgi?id=256717


This is the reason why all my issues for the improvements of the AQL support in Sirius have only be documented with screenshots from the Interpreter view.
Comment 15 Etienne Juliot CLA 2017-05-12 09:57:59 EDT
This bug generate also a problem with domain class completion:
completion on the parameter of oclIsTypeOf() search only in EClass name, not in prefix. 
example : "basicfamily::P" -> completion -> "basicfamily::Pbasicfamily::Person"

As the best practices is now to use prefix, it is a bigger problem than previous versions of Sirius.