Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext formatting and scoping with external functions?
Xtext formatting and scoping with external functions? [message #653505] Thu, 10 February 2011 01:56 Go to next message
Jon Riecke is currently offline Jon RieckeFriend
Messages: 9
Registered: May 2010
Junior Member
Two possibly heretical questions:

1. Suppose I have an existing Java function for formatting that, given a string, returns a formatted string. Can I hook that function into Xtext instead of using the Formatting API?

2. Suppose I have an existing Java function that, given a position in a string representing a name, returns the file and position of the definition of the name. Can I hook that function into Xtext instead of using the ScopeProvider API?

It's not that I dislike the infrastructure provided by Xtext---far from it! But I already have these functions, and would like to use them instead of reimplementing them and keeping them in sync with the versions using the Xtext API.

Thanks,
-Jon
Re: Xtext formatting and scoping with external functions? [message #653552 is a reply to message #653505] Thu, 10 February 2011 08:49 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Orthodox counterquestion: If the generated services work out-of-the-box,
why not use them ? ;-) As opposed to your approach, these will
automatically sync with changes in the language.

As far s the formatter is concerned, I guess it is easier to hook it
into the UI as a formatting action (operating on the text only) without
adapting it to Xtext's API, which is quite specific to the needs of
Xtext. That only works if you're not depending on semantic changes being
(selectively) serialized, e.g. semantic quickfixes or the upcoming
refactoring.

Your second question: Sounds like you could hook that into the
ILocationInFileProvider, at least partially. But I'd expect the generic
Xtext version to be working out-of-the-box.

Am 10.02.11 02:56, schrieb Jon Riecke:
> Two possibly heretical questions:
>
> 1. Suppose I have an existing Java function for formatting that, given a
> string, returns a formatted string. Can I hook that function into Xtext
> instead of using the Formatting API?
>
> 2. Suppose I have an existing Java function that, given a position in a
> string representing a name, returns the file and position of the
> definition of the name. Can I hook that function into Xtext instead of
> using the ScopeProvider API?
>
> It's not that I dislike the infrastructure provided by Xtext---far from
> it! But I already have these functions, and would like to use them
> instead of reimplementing them and keeping them in sync with the
> versions using the Xtext API.
>
> Thanks,
> -Jon


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Previous Topic:XText Mixins
Next Topic:Running XText in TestNG - google inject exception
Goto Forum:
  


Current Time: Thu Apr 25 03:36:35 GMT 2024

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

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

Back to the top