Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Content Assist Context(Customize the creation of content assist contexts)
Content Assist Context [message #1698589] Tue, 16 June 2015 10:34 Go to next message
Eclipse UserFriend
Hi guys,

I was checking the following slides from RepreZen

https://www.eclipsecon.org/na2015/sites/default/files/slides/RepreZen%20DSL%20Xtext%20Day%20(EclipseCon%20Website).pdf

And in the slide 63, they mentioned "hardcore code creating contexts", so I wanted to ask you if there is a recommendation to create custom content assist context or if it is considered a bad practice

For instance I have this grammar

MultipleKeyValuePairObj:
	{MultipleKeyValuePairObj} "{" (elements+=ObjectElement ("," elements+=ObjectElement?)*)? "}";


I want to add some logic to emit comma no matter if the line ends with comma or not in order to add one additional content assist context to use my proposal providers with a valid model

Example:

Case 1
{
    field1: @CursosHere@, // In this case the autocomplete works great
    field2: data
}


Case 2
{
    field1: @CursosHere@ // In this case the autocomplete does not work because there is not comma to split the fields
    field2: data
}


My question is regarding how to enhance the content assist, I can try to create custom content assist context (Meaning in certain situations I can emit extra commas to simulate a well defined grammar)

Another option is to mark commas as optional and then add some validation
If you believe this is the best way to go: Do you know how can I validate the existence of comma? I can use NodeModelUtils but it seems to me it can be a little expensive so it should be another way.

Best regards,
Luis
Re: Content Assist Context [message #1698672 is a reply to message #1698589] Wed, 17 June 2015 04:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Luis,

the missing proposals are likely caused by bogus predicates somewhere in
your grammar. Tuning the ContentAssistContext would be my last resort.
I'd rather carefully analyze your grammar structure.

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
Re: Content Assist Context [message #1698888 is a reply to message #1698672] Thu, 18 June 2015 10:16 Go to previous message
Eclipse UserFriend
Hi Sebastian,

Thanks for your answer, I will review the grammar and analyse different options.

Best regards,
Luis
Previous Topic:extending scoping for Xbase 2.4.0
Next Topic:IEObjectDocumentationProvider-Labels too small
Goto Forum:
  


Current Time: Wed Jul 02 19:44:04 EDT 2025

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

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

Back to the top