I'm having strange problems with non-.groovy extensions and dsld. I'm using Eclipse Juno SR2, and the development version of Groovy Eclipse (2.8.0.xx-20130528), but I get the same results in other configurations.
Here is a small project that shows those problems:
1. Create a Groovy project
2. Create three packages inside of /src: distances, dslds, and scripts
3. Copy Distance.groovy to distances
4. Copy DistanceDescriptor.dsld to dslds.
5. Create two files called Example.groovy and Example2.dsl in the scripts package. Both of them contain the same code.
6. Configure Eclipse to open the files with extension *.dsl with a Groovy editor.
And now the problems I see:
1. The icons of Example.dsl and Example.groovy look the same (a document with a 'g'), so I assume that they are recognized as a Groovy source files. When I open them, I see different syntax coloring (for example, println is light blue in the .dsl file and black in the groovy file).
2. To the left of the Example.groovy icon in the Package Explorer, there is an arrow that, when clicked, shows the outline of the classes in the file. There is no such arrow in Example2.dsl. When I add the *.dsl extension to the Preferences\General\Content Types\Text\Java Source File\Groovy Source File (for Groovy projects), the arrow appears, but I get syntax error all over the file.
3. Following the previous example, if I remove the association, and I clean the project, I can see in the Package Explorer two files named Example2.dsl. In one of them, highlighting and the class outline works as in a regular Groovy file, but in the other one not. After restarting Eclipse, the one that works disappears.
4. Given the DistanceDescriptor.dsld file, only the numbers in Example.groovy are detected as matches, not the Distance objects (for example, type before the closing brace "println 10." and hit Ctrl+Space, we get "cm", "km", etc., but if you type "println d1." and hit Ctrl+Space, no "cm", "km"... appears)
5. If we replace in DistanceDescriptor.dsld the file extension "groovy" with "dsl" and try the same example as the previous point in the Example.dsl file, it does not work neither for numbers nor Distance objects.
6. Add the following pattern to the Groovy Script Folders (Project Properties\Groovy Compiler): **/scripts/*.groovy, and break Example.groovy (for example, add this at the end of the file "println 1.m."). Eclipse marks the whole project as broken because Example.groovy does not compile (but it should not try to compile it in the first place, right?)
Could you please take a look and tell me if I'm doing something wrong? And by the way, I'm sorry for the length of this post.
Didn't see your message originally since it was posted to nabble only, not the mailing list.
Anyway, it looks like you configured the file associations only (controlling which editor is the default for opening files). You didn't configure content types. A content type is a more fundamental concept than a file association. A content type controls how the IDE performs operations on a file.
Go to Preferences -> General -> Content types and navigate the hierarchy Text -> Java Source -> Groovy source file. Then add your new extension there. This should work for you and makes the file association redundant.
On Thu, May 30, 2013 at 9:08 AM, Andrew Eisenberg <[hidden email]> wrote:
> Hi Paco,
> I missed the part where you said you tried adding the file extension
> as a content type.
> Just tried this myself and it looks like you need to restart eclipse
> before the new file extension is fully recognized by groovy-eclipse.
> So, all you need to do is add the content type and restart.
> This is a bug and it looks like it's because groovy-eclipse caches the
> groovy-like file extensions at startup. These are not changed even if
> content types change.
> On Wed, May 29, 2013 at 11:27 PM, PacoAbad <[hidden email]> wrote:
>> Hi Andrew
>> Thanks for your response, but it seems that you didn't read far enough (see
>> problem #2 in my original post).
>> View this message in context: http://groovy.329449.n5.nabble.com/Problems-with-non-groovy-extensions-and-dsld-tp5715586p5715601.html >> Sent from the groovy - user mailing list archive at Nabble.com.
>> To unsubscribe from this list, please visit:
>> http://xircles.codehaus.org/manage_email >>
To unsubscribe from this list, please visit: