Skip to main content



      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 02:24 Go to next message
Eclipse UserFriend
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 05:00 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Thu, 22 December 2011 05:01] by 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 05:14 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Thu, 22 December 2011 05:20] by 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 07:16 Go to previous messageGo to next message
Eclipse UserFriend
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 07:21 Go to previous message
Eclipse UserFriend
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
Previous Topic:Preserving comments
Next Topic:Cross reference problem when building after a Clean
Goto Forum:
  


Current Time: Tue Jul 08 01:42:40 EDT 2025

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

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

Back to the top