Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to limit content assist suggestion to same file
How to limit content assist suggestion to same file [message #792507] Tue, 07 February 2012 04:07 Go to next message
Gerrit van Doorn is currently offline Gerrit van DoornFriend
Messages: 15
Registered: January 2012
Junior Member
When I have 2 files with e.g. the Fowler state-machine DSL in a project folder and I press CTRL+space in a state I get event name suggestions from both state-machine files. How can I limit the suggestions to only display the event names from the file I'm editing?
Re: How to limit content assist suggestion to same file [message #792602 is a reply to message #792507] Tue, 07 February 2012 07:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14666
Registered: July 2009
Senior Member
Hi, are you sure you want to limit content assist only or do you want
to limit scoping in general (if you type stuff from the other file it
will be invalid too) regards Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to limit content assist suggestion to same file [message #792617 is a reply to message #792602] Tue, 07 February 2012 07:38 Go to previous messageGo to next message
Gerrit van Doorn is currently offline Gerrit van DoornFriend
Messages: 15
Registered: January 2012
Junior Member
Hi Christian,

I want to limit the scope too yes. I figured that one out. I guess I now need to change the ProposalProvider
Re: How to limit content assist suggestion to same file [message #792633 is a reply to message #792617] Tue, 07 February 2012 08:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14666
Registered: July 2009
Senior Member
No scoping and proposals go hand in hand so you have to change
scoping only e.g by switching to importuri based scoping


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to limit content assist suggestion to same file [message #792647 is a reply to message #792633] Tue, 07 February 2012 08:26 Go to previous messageGo to next message
Gerrit van Doorn is currently offline Gerrit van DoornFriend
Messages: 15
Registered: January 2012
Junior Member
Hmm, how would I do that?
So I have my ScopeProvider return only the states and events from the current file (so now it throws errors when I try to reference an event/state in the other file). My impression was that I need to change the ProposalProvider to limit what is shown in the content assistance (although initially I thought I only needed scoping, which is what you are telling me). How do I switch to importuri based scoping?
Re: How to limit content assist suggestion to same file [message #792672 is a reply to message #792647] Tue, 07 February 2012 09:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14666
Registered: July 2009
Senior Member
How does you DSL generation workflow look like?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to limit content assist suggestion to same file [message #792999 is a reply to message #792672] Tue, 07 February 2012 16:49 Go to previous messageGo to next message
Gerrit van Doorn is currently offline Gerrit van DoornFriend
Messages: 15
Registered: January 2012
Junior Member
I did change the workflow to enable ImportURIScopingFragment

// scoping and exporting API
fragment = scoping.ImportURIScopingFragment {}
fragment = exporting.SimpleNamesFragment {}

// scoping and exporting API
//fragment = scoping.ImportNamespacesScopingFragment {}
//fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}


However, it still shows me the events from my other file. I must be missing something.
Re: How to limit content assist suggestion to same file [message #793012 is a reply to message #792999] Tue, 07 February 2012 17:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14666
Registered: July 2009
Senior Member
Hi you have do deactivate typesgeneratorfragment or whatever it is
exactly called too


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to limit content assist suggestion to same file [message #793038 is a reply to message #793012] Tue, 07 February 2012 17:40 Go to previous message
Gerrit van Doorn is currently offline Gerrit van DoornFriend
Messages: 15
Registered: January 2012
Junior Member
Hi Christian,

Thanks! That works Smile. It's actually simpeler than I thought it should be. To recap for others, I only needed to change the following in the MWE2 workflow:

// scoping and exporting API
fragment = scoping.ImportURIScopingFragment {}
fragment = exporting.SimpleNamesFragment {}

// scoping and exporting API
//fragment = scoping.ImportNamespacesScopingFragment {}
//fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}

AND

//fragment = types.TypesGeneratorFragment {}


I did not have to write any scoping rules.


Previous Topic:XText parsing expressions with non-binary AST structure
Next Topic:How to iterate through a HashMap in Xtend?
Goto Forum:
  


Current Time: Fri Apr 26 16:46:07 GMT 2024

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

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

Back to the top