Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Auto -Complete for intellij , based web editor(Understand how can I configure auto-complete)
Auto -Complete for intellij , based web editor [message #1720627] Wed, 20 January 2016 03:01 Go to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I am using intellij and exploring web editor.
I would like to show the auto-complete proposal list without having to press Ctrl+Space . Like configure it for spacebar or blank space .

Please suggest Smile
Re: Auto -Complete for intellij , based web editor [message #1720635 is a reply to message #1720627] Wed, 20 January 2016 05:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

your questions are kind a missleading. you are targeting web. it does not matter if you develop in eclipse or intellij.
since the content assist is called by the client i guess you have to hack this somehow yourself.
the how depends on the client side editor impl.

from the code i can see there is no default hook for xtext-ace.
feel free to file an enhancement request.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto -Complete for intellij , based web editor [message #1720640 is a reply to message #1720635] Wed, 20 January 2016 06:40 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Ok.The reason for me mentioning about eclipse and intellij was because I thought it would be different based on the generated classes.
Re: Auto -Complete for intellij , based web editor [message #1720645 is a reply to message #1720640] Wed, 20 January 2016 07:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
It is
There is a class for eclipse one for idea and one for the web
You can enableLiveAutocompletion in ace but that will not react on space but on alphanumeric only

var editor = xtext.createEditor(...).setOptions({enableLiveAutocompletion:true}); // adaption of js code in index html


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto -Complete for intellij , based web editor [message #1720648 is a reply to message #1720645] Wed, 20 January 2016 07:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
digging into the ace api gives you following adaption to get live autocomplete all the time (including spaces through adapting the default regex)

var editor = xtext.createEditor({
					
					baseUrl: baseUrl,
					syntaxDefinition: "xtext-resources/generated/mode-mydsl2"
				});
				editor.completers.forEach(function(completer, i) {completer.identifierRegexps = [/[ a-zA-Z_0-9\$\-\u00A2-\uFFFF]/];});
				editor.setOptions({enableLiveAutocompletion: true})


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto -Complete for intellij , based web editor [message #1720655 is a reply to message #1720627] Wed, 20 January 2016 08:29 Go to previous messageGo to next message
Miro Spönemann is currently offline Miro SpönemannFriend
Messages: 78
Registered: March 2015
Location: Kiel, Germany
Member

For the Orion editor you can configure arbitrary characters to trigger content assist. For example, in order to do this for the space bar, include the option
contentAssistCharTriggers: " "
in your xtext.createEditor(..) call (in JavaScript).

See the charTriggers parameter in the Orion documentation:
https://wiki.eclipse.org/Orion/Documentation/Developer_Guide/Plugging_into_the_editor#orion.edit.contentAssist
Re: Auto -Complete for intellij , based web editor [message #1721973 is a reply to message #1720648] Tue, 02 February 2016 03:48 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Hi Christian ,

I have added the below to index.html file as


//snippet.
require(["webjars/ace/1.2.0/src/ace"], function() {
require(["xtext/xtext-ace"], function(xtext) {
xtext.createEditor({
baseUrl: baseUrl,
syntaxDefinition: "xtext-resources/generated/mode-eindsl",
}).completers.forEach(function(completer, i) {completer.identifierRegexps = [/[ a-zA-Z_0-9\$\-\u00A2-\uFFFF]/];}).setOptions({enableLiveAutocompletion: true});

I am not good with javascript. Please advise if this is the right way.
Re: Auto -Complete for intellij , based web editor [message #1721975 is a reply to message #1721973] Tue, 02 February 2016 04:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
sry i tried my example and it works. That is all i can say so far, for the rest you have to debug client and server side

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Auto -Complete for intellij , based web editor [message #1721976 is a reply to message #1721973] Tue, 02 February 2016 04:41 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I have solved this. Thank you
Re: Auto -Complete for intellij , based web editor [message #1721977 is a reply to message #1721975] Tue, 02 February 2016 04:42 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Ps what about sharing your complete example and all steps to so i can reproduce with 10 seconds effort and not 20 mins

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Accessing properties through JVM model
Next Topic:Regarding Category containing multi word
Goto Forum:
  


Current Time: Thu Apr 18 13:53:13 GMT 2024

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

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

Back to the top