Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Auto Completion
Auto Completion [message #1741106] Tue, 23 August 2016 07:16 Go to next message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
I have a task in eclipse to enable the functionality in which when we type in a particular word or character a pre defined word/character automatically appears without having to use ctrl+space.

Eg. if i write "begin" then "end" should appear automatically.
just like opening and closing brackets,etc
Re: Auto Completion [message #1741116 is a reply to message #1741106] Tue, 23 August 2016 08:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
this feature is called auto edit and configured via DefaultAutoEditStrategyProvider

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto Completion [message #1741147 is a reply to message #1741116] Tue, 23 August 2016 10:54 Go to previous messageGo to next message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
I am new to Xtext, So I wasnt able to find the class that you told. Is there anyother way to do this?
Re: Auto Completion [message #1741150 is a reply to message #1741147] Tue, 23 August 2016 11:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
the class full name is "org.eclipse.xtext.ui.editor.autoedit.DefaultAutoEditStrategyProvider" and it is contained in org.eclipse.xtext.ui
so it should be accessible from yourdsl.ui plugin.

where did you search for the class?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto Completion [message #1741165 is a reply to message #1741150] Tue, 23 August 2016 12:48 Go to previous messageGo to next message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
This is my Xtext project workspace
  • Attachment: Untitled.jpg
    (Size: 84.42KB, Downloaded 157 times)
Re: Auto Completion [message #1741166 is a reply to message #1741165] Tue, 23 August 2016 12:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
the class should be accessible from there

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto Completion [message #1741167 is a reply to message #1741166] Tue, 23 August 2016 12:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
can you paste the code you try to write?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto Completion [message #1741232 is a reply to message #1741167] Wed, 24 August 2016 04:22 Go to previous messageGo to next message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
Actually I am a beginner in Xtext.. and I was doing some hands-on, So I created this following:

grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"


Model:
greetings=Greeting;


Greeting:

rule1|rule2
;
rule1:
start='begin' text=STRING stop= 'end'
;
rule2:
start='begin' stop='end'
;

I dont even know if this grammar is write according to my needs.
Re: Auto Completion [message #1741233 is a reply to message #1741232] Wed, 24 August 2016 04:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Did you have a look at the domain model example. It contains an edit strategy

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto Completion [message #1741236 is a reply to message #1741233] Wed, 24 August 2016 05:22 Go to previous messageGo to next message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
Okay I did something in the MyDslUiModule and now I can find that class which you mentioned but is shows some error.
I have attached a screen shot of it
  • Attachment: Image2.png
    (Size: 92.66KB, Downloaded 185 times)
Re: Auto Completion [message #1741237 is a reply to message #1741236] Wed, 24 August 2016 05:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
well you code is java code and the module is written in xtend so you have to transform it to a xtend method

def Class<? extend InsertBaseClassHere> bindInsertBaseClassHere() {
InsertCustomClassHere
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto Completion [message #1741241 is a reply to message #1741237] Wed, 24 August 2016 05:56 Go to previous message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
Thanks for your help!
Previous Topic:New line space error
Next Topic:use of ->
Goto Forum:
  


Current Time: Thu Mar 28 22:28:32 GMT 2024

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

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

Back to the top