Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Code template insertion error(When template is inserted, it deletes one previous symbol)
Code template insertion error [message #1712918] Thu, 29 October 2015 10:51 Go to next message
Nemanja Bjelica is currently offline Nemanja BjelicaFriend
Messages: 14
Registered: October 2015
Junior Member
Hi guys,

I inherited work from my colleague who worked with Xtext, and I am facing with a annoying problem. I define a code template in Preference page, and when I want to add it in the editor with ctrl+space, template is added, but it deletes previous token (or symbol).

So, I've line of code:
LOAD A0, A1

when I try to add third parameter after typing comma and choosing template, I get this
LOAD A0, A1dummy() instead LOAD A0, A1, dummy()

I've been debugging for couple of days, and I'm guessing the problem is in the replace region offset of the template context, but I can't find the fix. Can someone point me where to look?

Note: This problem only occurs when I choose code templates from content assist, not with other options in content assist popup menu.

Thanks,
Beli
Re: Code template insertion error [message #1712925 is a reply to message #1712918] Thu, 29 October 2015 12:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14336
Registered: July 2009
Senior Member
can you share grammar and a test? could be similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=466372

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Code template insertion error [message #1712931 is a reply to message #1712925] Thu, 29 October 2015 12:41 Go to previous messageGo to next message
Nemanja Bjelica is currently offline Nemanja BjelicaFriend
Messages: 14
Registered: October 2015
Junior Member
Christian, thanks for your quick reply.

Unfortunately, grammar is too big (over 1k lines of code) and it is a part of a big project. I'm aware you can't help me much without it, but do you have any other hints or ideas?

I am Xtext beginner and my main focus was on TemplateProposal's apply method and understanding start and end indexes and replace offset . Could a problem lie in grammar?

Thanks,
Beli
Re: Code template insertion error [message #1712932 is a reply to message #1712931] Thu, 29 October 2015 12:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14336
Registered: July 2009
Senior Member
can you try to create a very simple grammar that reproduces the problem?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Code template insertion error [message #1712933 is a reply to message #1712932] Thu, 29 October 2015 12:56 Go to previous message
Nemanja Bjelica is currently offline Nemanja BjelicaFriend
Messages: 14
Registered: October 2015
Junior Member
I'll give it a try, but it will take me some time.
Previous Topic:UI test plugin is not found in 2.8.1
Next Topic:Updating emf does not reflect on Node model
Goto Forum:
  


Current Time: Wed Aug 10 21:28:35 GMT 2022

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

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

Back to the top