Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext editor to insert single proposals automatically without showing content assist popup
Xtext editor to insert single proposals automatically without showing content assist popup [message #769500] Thu, 22 December 2011 07:24 Go to next message
Kuldeep Jain is currently offline Kuldeep JainFriend
Messages: 6
Registered: December 2011
Junior Member
In my Xtext editor I want to enable "insert single proposals automatically" by default.
In essence what want is to have auto completion when there is only one matching choice to show up in content assist when we hit Ctrl-Space.

In eclipse(java editor) this can be configured from Windows->Preferences go to Java->Editor->Content Assist page and select "insert single proposals automatically" checkbox.
Re: Xtext editor to insert single proposals automatically without showing content assist popup [message #769550 is a reply to message #769500] Thu, 22 December 2011 10:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

this is already default behaviour in the current Xtext Version (2.2.x).
(at least at most places). Which Version do you use?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 22 December 2011 10:01]

Report message to a moderator

Re: Xtext editor to insert single proposals automatically without showing content assist popup [message #769554 is a reply to message #769550] Thu, 22 December 2011 10:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
P.S:

some proposals can determine themselves if they are autoinsertable.
see org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.isAutoInsertable()
so you may have to overwrite

the places where this is set to false e.g.
org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider.complete_ID(EObject, RuleCall, ContentAssistContext, ICompletionProposalAcceptor)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 22 December 2011 10:20]

Report message to a moderator

Re: Xtext editor to insert single proposals automatically without showing content assist popup [message #769616 is a reply to message #769554] Thu, 22 December 2011 12:16 Go to previous messageGo to next message
Kuldeep Jain is currently offline Kuldeep JainFriend
Messages: 6
Registered: December 2011
Junior Member
Thanks for your reply Christian. I am using Xtext 2.1.1.

The proposals that I have overridden in my {MyLang}ProposalProvider class already have "autoInsertable" set to 'true' as its default value in ConfigurableCompletionProposal class is true. But that does not seem to be working as I still do not get the proposal auto-inserted but get the content assist popup with just one entry which I have to explicitly select. Am I missing something?

Moreover I want to have auto-insert ON for all the values, even for those which I do not override in my {MyLang}ProposalProvider class (for which default content assist is provided by xtext).
Re: Xtext editor to insert single proposals automatically without showing content assist popup [message #769620 is a reply to message #769616] Thu, 22 December 2011 12:21 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

as i said: there are places e.g. org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider.complete_ID(EObject, RuleCall, ContentAssistContext, ICompletionProposalAcceptor) that set the autoinsert to false.
so in this case it will not be autoinserted unless you do not use this stull or fix it.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Preserving comments
Next Topic:Cross reference problem when building after a Clean
Goto Forum:
  


Current Time: Fri Apr 26 03:39:01 GMT 2024

Powered by FUDForum. Page generated in 0.03683 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top