Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Syntax Error in lambda implementing Xtext quickfixes
Syntax Error in lambda implementing Xtext quickfixes [message #1790980] Wed, 20 June 2018 22:40 Go to next message
Jonathan Gossage is currently offline Jonathan GossageFriend
Messages: 71
Registered: March 2010
Location: Ottawa, ON, Canada
Member
I am new to `Xtend/Xtext and am attempting to learn using the book Implementing Domain Specific Languages with Xtext and Xtend .The code shown below comes from Chapter 4, section Quickfixes for default validators.

I am using Xtext 2.14 on Eclipse Oxygen 3A running on up to date Windows 10 Insider Preview.

The attached image shows the problem. Xtend is complaining about the closing parenthesis in line 67, however it is needed to balance the opening parenthesis on the same line. Furthermore when I attempt to display matching parentheses, the closing parenthesis on Line 68 is shown as matching the opening parenthesis on line 57 instead of the opening parenthesis on line 65 which is the correct match.

If I remove the closing parenthesis on line 67 the code compiles successfully and I can run it successfully.

I tried, and failed, to produce a simpler test case but all my attempts worked successfully. Is this a problem I am unable to see or is this a bug?

[Updated on: Thu, 21 June 2018 00:29]

Report message to a moderator

Re: Syntax Error in lambda implementing Xtext quickfixes [message #1790984 is a reply to message #1790980] Thu, 21 June 2018 04:15 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi can you please post the code here.
Counting parens in a screenshot is pita
here is a working greeting example

	@Fix(MyDslValidator.INVALID_NAME)
	def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) {
		acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png', [
			element, context |
			val currentGreeting = element as Greeting
			val model = element.eContainer as Model
			model.greetings.add(model.greetings.indexOf(currentGreeting)+1,MyDslFactory.eINSTANCE.createGreeting=>[
				name = currentGreeting.name.toFirstUpper
			])
		])
	}


did you try to open and close the editor?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 21 June 2018 04:29]

Report message to a moderator

Previous Topic:OneOf
Next Topic:XtextLinkingDiagnostic Error while loading xtext model
Goto Forum:
  


Current Time: Thu Apr 25 14:23:17 GMT 2024

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

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

Back to the top