Skip to main content



      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 08:28 Go to next message
Eclipse UserFriend
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 12:57 Go to previous messageGo to next message
Eclipse UserFriend
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)

[Updated on: Mon, 21 January 2019 13:04] by Moderator

Re: Customize the inserted value from auto-complete from the proposed [message #1801599 is a reply to message #1801525] Wed, 23 January 2019 05:28 Go to previous messageGo to next message
Eclipse UserFriend
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 06:42 Go to previous messageGo to next message
Eclipse UserFriend
if you do imports correct this should work automatically
Re: Customize the inserted value from auto-complete from the proposed [message #1801615 is a reply to message #1801604] Wed, 23 January 2019 08:33 Go to previous messageGo to next message
Eclipse UserFriend
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 10:13 Go to previous messageGo to next message
Eclipse UserFriend
can you debug into FQNPrefixMatcher / PrefixMatcher
and which one is used?
Re: Customize the inserted value from auto-complete from the proposed [message #1801691 is a reply to message #1801617] Thu, 24 January 2019 13:55 Go to previous messageGo to next message
Eclipse UserFriend
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 14:03] by Moderator

Re: Customize the inserted value from auto-complete from the proposed [message #1801694 is a reply to message #1801691] Thu, 24 January 2019 15:02 Go to previous message
Eclipse UserFriend
can you please provide a minimal reproducing example
Previous Topic:Generated Files do not auto-compile
Next Topic:Cross reference with dot in a name
Goto Forum:
  


Current Time: Mon Jun 23 22:16:07 EDT 2025

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

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

Back to the top