Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Autocomplete inconsistent with syntactic sugar
Autocomplete inconsistent with syntactic sugar [message #1735729] Wed, 22 June 2016 09:49 Go to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I tried to get the value of a boolean data with the variable name as isValid.

for(m: resource.allContents.toIterable.filter(typeof(Directory)))
{
val info = new Information()
info.setIsValid(m.isValid) //inconsistent
}


On some part of my code, auto complete displays m.isIsValid, which still works perfectly, but is just a sore to my eyes. I would prefer that it expands similarly. Is there a way to set this in Eclipse?
Re: Autocomplete inconsistent with syntactic sugar [message #1735730 is a reply to message #1735729] Wed, 22 June 2016 10:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
am not sure if i get you

class Information {
	
	def void setIsValid(boolean b) {
		
	}
	
	def boolean getIsValid() {
		true
	}
	
}

class Demo {
	
	def doSth() {
		val i = new Information
		i.isValid = true
		i.isValid == true
	}
	
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Autocomplete inconsistent with syntactic sugar [message #1735731 is a reply to message #1735730] Wed, 22 June 2016 10:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
same for

	def boolean isIsValid() {
		true
	}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Autocomplete inconsistent with syntactic sugar [message #1735953 is a reply to message #1735731] Fri, 24 June 2016 02:30 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I am using autocomplete in Eclipse. My variable name is "isValid" with boolean type. When I type "m.is" and press Ctrl+Space and choose the correct variable, it will sometimes expand to m.isIsValid, which is technically the same as m.isValid. The variable is declared in xcore. And referred to in xtend.

for(m: resource.allContents.toIterable.filter(typeof(Directory)))
{
val info = new Information()
info.setIsValid(m.isValid) //can also be auto-completed as m.isIsValid
info.setIsValid(m.isIsValid) // works completely ok but is different from the previous line.
}

[Updated on: Fri, 24 June 2016 02:30]

Report message to a moderator

Re: Autocomplete inconsistent with syntactic sugar [message #1735958 is a reply to message #1735953] Fri, 24 June 2016 03:50 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
But then you have strange naming inside your Java bean right

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtend cannot see methods in Xtext's generated classes
Next Topic:[Xtext] Referring to an enum member
Goto Forum:
  


Current Time: Fri Apr 19 21:52:24 GMT 2024

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

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

Back to the top