Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Auto Completion
Auto Completion [message #1741106] Tue, 23 August 2016 03:16 Go to next message
Eclipse UserFriend
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 04:07 Go to previous messageGo to next message
Eclipse UserFriend
this feature is called auto edit and configured via DefaultAutoEditStrategyProvider
Re: Auto Completion [message #1741147 is a reply to message #1741116] Tue, 23 August 2016 06:54 Go to previous messageGo to next message
Eclipse UserFriend
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 07:05 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: Auto Completion [message #1741165 is a reply to message #1741150] Tue, 23 August 2016 08:48 Go to previous messageGo to next message
Eclipse UserFriend
This is my Xtext project workspace
  • Attachment: Untitled.jpg
    (Size: 84.42KB, Downloaded 187 times)
Re: Auto Completion [message #1741166 is a reply to message #1741165] Tue, 23 August 2016 08:49 Go to previous messageGo to next message
Eclipse UserFriend
the class should be accessible from there
Re: Auto Completion [message #1741167 is a reply to message #1741166] Tue, 23 August 2016 08:50 Go to previous messageGo to next message
Eclipse UserFriend
can you paste the code you try to write?
Re: Auto Completion [message #1741232 is a reply to message #1741167] Wed, 24 August 2016 00:22 Go to previous messageGo to next message
Eclipse UserFriend
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 00:42 Go to previous messageGo to next message
Eclipse UserFriend
Did you have a look at the domain model example. It contains an edit strategy
Re: Auto Completion [message #1741236 is a reply to message #1741233] Wed, 24 August 2016 01:22 Go to previous messageGo to next message
Eclipse UserFriend
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 220 times)
Re: Auto Completion [message #1741237 is a reply to message #1741236] Wed, 24 August 2016 01:26 Go to previous messageGo to next message
Eclipse UserFriend
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
}
Re: Auto Completion [message #1741241 is a reply to message #1741237] Wed, 24 August 2016 01:56 Go to previous message
Eclipse UserFriend
Thanks for your help!
Previous Topic:New line space error
Next Topic:use of ->
Goto Forum:
  


Current Time: Mon Jul 07 15:59:10 EDT 2025

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

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

Back to the top