Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Xtext formatting and scoping with external functions?
Xtext formatting and scoping with external functions? [message #653505] Wed, 09 February 2011 20:56 Go to next message
Eclipse UserFriend
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 03:49 Go to previous message
Eclipse UserFriend
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
Previous Topic:XText Mixins
Next Topic:Running XText in TestNG - google inject exception
Goto Forum:
  


Current Time: Thu Jul 10 00:38:36 EDT 2025

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

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

Back to the top