Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Code completion for Java imports
Code completion for Java imports [message #918848] Fri, 21 September 2012 12:02 Go to next message
Aaron Digulla is currently offline Aaron DigullaFriend
Messages: 258
Registered: July 2009
Location: Switzerland
Senior Member
This should be a common topic but Google didn't turn up anything useful: How do I get code completion in the DSL editor for a Java-like import statement?

import java.util.D|


should offer "java.util.Date"

How do I do that?

Regards,

A. Digulla
Re: Code completion for Java imports [message #920019 is a reply to message #918848] Sat, 22 September 2012 16:34 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
As far as I know, there is no direct support for that when using
'importedNamespace'...

the html routing example,
http://www.eclipse.org/Xtext/7languagesDoc.html#httpRouting , uses
"validated imports":

"in the routing DSL we use real cross-references to Java types in
imports. Although it is not as convenient to implement, it has the
advantage having imports validated and getting proper content assist in
your imports section. For future releases it is planned to significantly
improve support for import sections for JVM languages including nice IDE
features like organize imports. "

hope this helps
Lorenzo

On 09/21/2012 02:02 PM, Aaron Digulla wrote:
> This should be a common topic but Google didn't turn up anything useful:
> How do I get code completion in the DSL editor for a Java-like import
> statement?
>
>
> import java.util.D|
>
>
> should offer "java.util.Date"
>
> How do I do that?

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Code completion for Java imports [message #922659 is a reply to message #920019] Tue, 25 September 2012 08:02 Go to previous messageGo to next message
Aaron Digulla is currently offline Aaron DigullaFriend
Messages: 258
Registered: July 2009
Location: Switzerland
Senior Member
Thanks, the example grammar led me on the right track.

But one more question: What do you mean by "when using 'importedNamespace'"? What is "importedNamespace"?

Regards,

A. Digulla
Re: Code completion for Java imports [message #927268 is a reply to message #922659] Sat, 29 September 2012 12:58 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 09/25/2012 10:02 AM, Aaron Digulla wrote:
> Thanks, the example grammar led me on the right track.
>
> But one more question: What do you mean by "when using
> 'importedNamespace'"? What is "importedNamespace"?
>

I mean this one (from the documentation), which, I assumed, was your
initial setting:

Imports can be defined in a very convenient way with Xtext. If you use
the name importedNamespace in a parser rule, the framework will treat
the value as an import. It even supports wildcard and handles them as
expected:

Import:
'import' importedNamespace = QualifiedNameWithWildcard
;
QualifiedNameWithWildcard:
QualifiedName '.*'?
;


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:Multipage Editor with Xtext
Next Topic:Permission of the generated files
Goto Forum:
  


Current Time: Fri Apr 19 05:37:09 GMT 2024

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

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

Back to the top