Skip to main content



      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 06:51 Go to next message
Eclipse UserFriend
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 08:04 Go to previous messageGo to next message
Eclipse UserFriend
can you share grammar and a test? could be similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=466372
Re: Code template insertion error [message #1712931 is a reply to message #1712925] Thu, 29 October 2015 08:41 Go to previous messageGo to next message
Eclipse UserFriend
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 08:46 Go to previous messageGo to next message
Eclipse UserFriend
can you try to create a very simple grammar that reproduces the problem?
Re: Code template insertion error [message #1712933 is a reply to message #1712932] Thu, 29 October 2015 08:56 Go to previous message
Eclipse UserFriend
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: Sun Jul 27 06:36:58 EDT 2025

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

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

Back to the top