Home » Modeling » TMF (Xtext) » [xText] code completion
[xText] code completion [message #19738] |
Fri, 08 August 2008 06:45  |
Eclipse User |
|
|
|
Hi
concerning the generated code completion feature I found something that
I think is not completely correct;
for instance, consider the tutorial (entity relation)
If I press Ctrl+Space I get the list of keywords, but when I continue
typing the initial part of the keyword, the list of alternatives is not
updated (e.g., it should list only the keywords that start with the
typed prefix and select the first element of the filtered list); see the
screen shot:
http://img175.imageshack.us/img175/6092/completionfk9.png
Note that this feature works correctly, for instance, for the list of
types (I think these are called "assignments"?), see the screenshot:
http://img175.imageshack.us/img175/5830/completion1yh1.png
is this a bug or an intentional feature?
How can this be overridden?
thanks in advance
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
|
|
| |
Re: [xText] code completion [message #19911 is a reply to message #19860] |
Fri, 08 August 2008 12:27   |
Eclipse User |
|
|
|
But this I'll lose also the other (working) features of the content
assist (e.g., the ones for assignments), won't I?
Sven Efftinge wrote:
> Seems to be a bug.
>
> It is only possible to replace the whole IContentAssistProcessor with a
> custom one.
>
> To do so add a class 'SpecialUtlities.java' to your editor-project's
> src/ folder and let it extend the generated [LanguageName]Utilities class.
> Then change the conctructor call in the Plugin class from
> [LanguageName]Utilities to SpecialUtilities.
>
> In SpecialUtlities you can overwrite the method used to obtain the
> content assist processor:
>
>
> @Override
> public IContentAssistProcessor getContentAssistProcessor() {
> // TODO Auto-generated method stub
> return super.getContentAssistProcessor();
> }
>
>
> Lorenzo Bettini schrieb:
>> Hi
>>
>> concerning the generated code completion feature I found something
>> that I think is not completely correct;
>>
>> for instance, consider the tutorial (entity relation)
>>
>> If I press Ctrl+Space I get the list of keywords, but when I continue
>> typing the initial part of the keyword, the list of alternatives is
>> not updated (e.g., it should list only the keywords that start with
>> the typed prefix and select the first element of the filtered list);
>> see the screen shot:
>>
>> http://img175.imageshack.us/img175/6092/completionfk9.png
>>
>> Note that this feature works correctly, for instance, for the list of
>> types (I think these are called "assignments"?), see the screenshot:
>>
>> http://img175.imageshack.us/img175/5830/completion1yh1.png
>>
>> is this a bug or an intentional feature?
>>
>> How can this be overridden?
>>
>> thanks in advance
>> Lorenzo
>>
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
|
|
|
Re: [xText] code completion [message #19997 is a reply to message #19911] |
Fri, 08 August 2008 12:50   |
Eclipse User |
|
|
|
By the way, any documentation on how content assist proposals are
implemented by xtext? I can't seem to figure this out from the sources...
Lorenzo Bettini wrote:
> But this I'll lose also the other (working) features of the content
> assist (e.g., the ones for assignments), won't I?
>
> Sven Efftinge wrote:
>> Seems to be a bug.
>>
>> It is only possible to replace the whole IContentAssistProcessor with
>> a custom one.
>>
>> To do so add a class 'SpecialUtlities.java' to your editor-project's
>> src/ folder and let it extend the generated [LanguageName]Utilities
>> class.
>> Then change the conctructor call in the Plugin class from
>> [LanguageName]Utilities to SpecialUtilities.
>>
>> In SpecialUtlities you can overwrite the method used to obtain the
>> content assist processor:
>>
>>
>> @Override
>> public IContentAssistProcessor getContentAssistProcessor() {
>> // TODO Auto-generated method stub
>> return super.getContentAssistProcessor();
>> }
>>
>>
>> Lorenzo Bettini schrieb:
>>> Hi
>>>
>>> concerning the generated code completion feature I found something
>>> that I think is not completely correct;
>>>
>>> for instance, consider the tutorial (entity relation)
>>>
>>> If I press Ctrl+Space I get the list of keywords, but when I continue
>>> typing the initial part of the keyword, the list of alternatives is
>>> not updated (e.g., it should list only the keywords that start with
>>> the typed prefix and select the first element of the filtered list);
>>> see the screen shot:
>>>
>>> http://img175.imageshack.us/img175/6092/completionfk9.png
>>>
>>> Note that this feature works correctly, for instance, for the list of
>>> types (I think these are called "assignments"?), see the screenshot:
>>>
>>> http://img175.imageshack.us/img175/5830/completion1yh1.png
>>>
>>> is this a bug or an intentional feature?
>>>
>>> How can this be overridden?
>>>
>>> thanks in advance
>>> Lorenzo
>>>
>
>
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
|
|
| |
Re: [xText] code completion [message #20099 is a reply to message #19860] |
Sat, 09 August 2008 06:12   |
Eclipse User |
|
|
|
Sven Efftinge wrote:
> Seems to be a bug.
>
I also filed a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=243610
and I also proposed a patch;
I think I found where the problem with the content assist is:
in the class
org.openarchitectureware.xtext.editor.contentassist.XTextMod elContentAssist
the createProposals method should always be called with the last
argument applyPrefixFilter to true, even if this test
if (lastComplete != null && lastComplete.getEnd() >= offset)
fails (however, I don't understand what lastComplete stands for).
See the attached patch (by the way, I tested this patch by copying this
class in my project and modifying it, by also using a customized
Utilities class).
This way, the list of keywords is correctly filtered when typing.
With this patch, assignment elements are still filtered too; however, I
noticed that the filter applies to their labels. The labels are the
final replacement strings, not the ones that are shown in the list of
proposals. Is this intentional and correct?
For instance, if I have this customized content proposal:
/* proposals for Feature LineElem::start */
List[Proposal] completeDelimElem_name(emf::EObject ctx, String prefix) :
{newProposal("delimited element", "elem delim \"\" \"\""),
newProposal("delimited element (complete)", "elem delim \"\" \"\"
escape \"\" multiline")};
then ths proposal list will show
"delimited element"
"delimited element (complete)"
but the filter will apply to
"elem delim \"\" \"\""
"elem delim \"\" \"\" escape \"\" multiline"
Is this correct?
Or I'm implementing the proposal in the wrong way myself?
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
|
|
|
Re: [xText] code completion [message #21377 is a reply to message #20099] |
Wed, 13 August 2008 11:22  |
Eclipse User |
|
|
|
Originally posted by: sven.efftinge.de
Thanks, Patrick already applied it.
It's in the nightly builds.
Sven
Lorenzo Bettini schrieb:
> Sven Efftinge wrote:
>> Seems to be a bug.
>>
>
> I also filed a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=243610
>
> and I also proposed a patch;
>
> I think I found where the problem with the content assist is:
>
> in the class
> org.openarchitectureware.xtext.editor.contentassist.XTextMod elContentAssist
> the createProposals method should always be called with the last
> argument applyPrefixFilter to true, even if this test
>
> if (lastComplete != null && lastComplete.getEnd() >= offset)
>
> fails (however, I don't understand what lastComplete stands for).
>
> See the attached patch (by the way, I tested this patch by copying this
> class in my project and modifying it, by also using a customized
> Utilities class).
>
> This way, the list of keywords is correctly filtered when typing.
>
> With this patch, assignment elements are still filtered too; however, I
> noticed that the filter applies to their labels. The labels are the
> final replacement strings, not the ones that are shown in the list of
> proposals. Is this intentional and correct?
>
> For instance, if I have this customized content proposal:
>
> /* proposals for Feature LineElem::start */
> List[Proposal] completeDelimElem_name(emf::EObject ctx, String prefix) :
> {newProposal("delimited element", "elem delim \"\" \"\""),
> newProposal("delimited element (complete)", "elem delim \"\" \"\"
> escape \"\" multiline")};
>
> then ths proposal list will show
>
> "delimited element"
> "delimited element (complete)"
>
> but the filter will apply to
>
> "elem delim \"\" \"\""
> "elem delim \"\" \"\" escape \"\" multiline"
>
> Is this correct?
> Or I'm implementing the proposal in the wrong way myself?
>
|
|
|
Goto Forum:
Current Time: Wed Jul 16 22:08:56 EDT 2025
Powered by FUDForum. Page generated in 0.04925 seconds
|