Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Customize the inserted value from auto-complete from the proposed
Customize the inserted value from auto-complete from the proposed [message #1801514] Mon, 21 January 2019 13:28 Go to next message
Eleanor Richie is currently offline Eleanor RichieFriend
Messages: 125
Registered: August 2014
Senior Member
In my language, I have a sort of a package and it contains several primary rules in it. Primary rules contain some variables that can be used directly by their name or using fully qualified name.
Example:
PACKAGE pack:
GENERAL gen:
VARIABLE foo : string ;
VARIABLE foo2 : boolean ;
END GENERAL;
END PACKAGE;

In the scope, I managed to create a scope for the rule GENERAL where all the items in it are available only in it. The scope is created by fully qualified names as pack.gen.foo, pack.gen.foo2 and then I created an ImportNormalizer with pack.gen and an ImportScope in order to be able to use foo alone and pack.gen.foo

My problem now is that when I auto-complete, I need when I write pack. to have the gen ONLY as a suggestion and not keywords, pack.gen.foo and pack.gen.foo2

Another problem, when I choose from the auto-complete list the pack.gen.foo option, I need the entered text to be just foo and not the fully qualified name.
Can you help me with these problems?
Re: Customize the inserted value from auto-complete from the proposed [message #1801525 is a reply to message #1801514] Mon, 21 January 2019 17:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13071
Registered: July 2009
Senior Member
i i cannot follow you. can you please give more context
am not sure if you built your scope correct
cross ref proposals are created at org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.DefaultProposalCreator.apply(IEObjectDescription)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 21 January 2019 18:04]

Report message to a moderator

Re: Customize the inserted value from auto-complete from the proposed [message #1801599 is a reply to message #1801525] Wed, 23 January 2019 10:28 Go to previous messageGo to next message
Eleanor Richie is currently offline Eleanor RichieFriend
Messages: 125
Registered: August 2014
Senior Member
In my language, I have packages where I can import them to be used by other rules. i.e.
PACKAGE pack:
GENERAL gen:
VARIABLE foo : string ;
VARIABLE foo2 : boolean ;
END GENERAL;
END PACKAGE;
// In the same file I can add something like this to use the above declared variables
USE pack.gen.*
FUNCTION func:
foo = "Assignment";
pack.gen.foo = "Still valid sytnax";
END FUNCTION;

In the previous function, I need to import all the variables in gen and to be able to write them as foo and by their fully qualified name pack.gen.foo . So, in order to make this, I created an importscope with all the variables and added a normalizer pack.gen to allow me to write them as foo. My problem is that in auto-complete, when I write pack.gen. and then make auto-complete, I still get another variables from another generals that I didnot import. Also, I need when I have the suggestion in the auto-complete pack.gen.foo, when I choose it, the inserted text to be just foo and not its fully qualified name (pack.gen.foo)
Re: Customize the inserted value from auto-complete from the proposed [message #1801604 is a reply to message #1801599] Wed, 23 January 2019 11:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13071
Registered: July 2009
Senior Member
if you do imports correct this should work automatically

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Customize the inserted value from auto-complete from the proposed [message #1801615 is a reply to message #1801604] Wed, 23 January 2019 13:33 Go to previous messageGo to next message
Eleanor Richie is currently offline Eleanor RichieFriend
Messages: 125
Registered: August 2014
Senior Member
Thanks alot :) I noticed that it works fine when I auto-complete at "pa" or at "pack.gen" or any autocomplete before the "." . When I autocomplete at "pack.gen." the proposed list does not take into consideration the previously written text and proposes all the items that came from the scope. Any help with the "." issue...
Re: Customize the inserted value from auto-complete from the proposed [message #1801617 is a reply to message #1801615] Wed, 23 January 2019 15:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13071
Registered: July 2009
Senior Member
can you debug into FQNPrefixMatcher / PrefixMatcher
and which one is used?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Customize the inserted value from auto-complete from the proposed [message #1801691 is a reply to message #1801617] Thu, 24 January 2019 18:55 Go to previous messageGo to next message
Eleanor Richie is currently offline Eleanor RichieFriend
Messages: 125
Registered: August 2014
Senior Member
FQNPrefixMatcher is used,, the prefix returned in the case of auto-complete after pack. is "" and not "pack." :(
In case of auto-complete at pac, the prefix is returned pac and so the suggestions are filtered correctly
Any help how can I fix the prefix to be correct?

[Updated on: Thu, 24 January 2019 19:03]

Report message to a moderator

Re: Customize the inserted value from auto-complete from the proposed [message #1801694 is a reply to message #1801691] Thu, 24 January 2019 20:02 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13071
Registered: July 2009
Senior Member
can you please provide a minimal reproducing example

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Generated Files do not auto-compile
Next Topic:Cross reference with dot in a name
Goto Forum:
  


Current Time: Thu Aug 22 18:39:40 GMT 2019

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

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

Back to the top