Can syntax highlighting be enabled for Groovy DSL with custom file extension in Eclipse? - eclipse

We are working on creating a custom Domain Specific Language in Groovy. We plan to use a custom file name extension ( for example .xyz ) for the code written in this DSL.
I and using eclipse as my IDE.
When i change the extension of the file from .groovy to .xyz, eclipse considers this file as a text file and removes all the color codes that are associated with a groovy file.
Is there any configuration in Eclipse that will associate the .xyz file as a groovy source file?
I see that there are a .dsld file https://spring.io/blog/2011/05/09/better-dsl-support-in-groovy-eclipse but this do not seem to be a solution to my above problem.

You can associate a file extension with a editor content type in the Eclipse Preferences. Go to the 'General > Content Types' page in the preferences.
Find and select the Groovy content type in the list and click 'Add..' to add your '.xyz' extension to the list of file associations.
You can also do this in an Eclipse plugin using org.eclipse.core.contenttype.contentTypes extension point.

Related

How to add support for Jenkinsfile* in PhpStorm?

In PhpStorm the Jenkinsfile's code is highlighted and autocompleted. In my project I have multiple Jenkinsfiles (like Jenkinsfile_DEV, Jenkinsfile_TEST, Jenkinsfile_PROD). In that files highlighting and autocompletion are not working.
How to get PhpStorm supporting not only the files with the name Jenkinsfile, but also associate other files with this highlighting/autocompletion (e.g. Jenkinsfile_*)?
What I tried so far: I looked for the "Jenkinsfile" entry in the File -> Settings -> Editor -> File Types -> Recognized file types. The plan was just to add an entry like "Jenkinsfile*" to the "Jenkinsfile" entry. But I haven't found an entry like this.
Jenkinsfile syntax is provided by Groovy textmate bundles at File | Settings | Editor | TextMate Bundles. Unfortunately it's not configurable: Jenkinsfile is hardcoded to be associated with Groovy in PhpStorm. The only option here is to add .groovy extension to those files.

Custom syntax for workspace in VSCode

I have a custom syntax (json varietas) for a specific project.
I've created a project that contains the t-json.tmLanguage.json and language-configuration.json, but I won't publish it as an extension because it's not general used.
So can I configure something in .vscode/ folder for support the syntax only for this workspace?

To create yml file in eclipse

I would like to create buildspec.yml file in eclipse. I have downloaded yaml editor and ydit from eclipse market place. How to create yaml file in src code. i could see only class and other files. not yaml. Please help on this
It's just normal file text, Right click your wanted project -> New -> Other -> File.
If you need more support you could install Yedit from Eclipse Market.
YEdit is an Eclipse editor for editing YAML files. It has the following features:
Syntax highlighting
Syntax checking
Content outline
Templates
Various text editing support like auto-indenting and toggling of comments.
Symfony compatibility mode. * Source formatting (experimental)
Use Right-click > New > Other > File and make sure its extension is .yaml or .yml.
PS: I suggest you try https://marketplace.eclipse.org/content/eclipse-wild-web-developer-web-development-eclipse-ide instead of Yedit. It's a better alternative IMO.

How can I make plugin auto open specify file by internal editor in eclipse?

I'm writting a plugin, open the abc.txt file, and when I already finish create abc.txt, I want to eclipse auto open this file using a internal editor (example ckeditor). How can I do that?
IDE.openEditor(page, input, "org.eclipse.ckeditor");
I use this code but it's not work.
Anybody help me?
To find the id of an editor you look for the org.eclipse.ui.editors extension point used to declare the editor in the plugin.xml file in the plugin jar.
In this case the editor id is org.eclipse.ckeditor.editors.CKEditor

How to set template file for properties files in Eclipse?

It is easy to set the template for build.xml(Window->Preferences->Ant->Editor->Template), but I could not figure out how to set template for properties file. In Window->Perference, there is not a properties editor->template option at all.
So how could I set the template for properties file?
Thanks.
It seems that the properties file editor inside eclipse does not have the template file features.
If fact , you can open the the *.properties using any editors with the template file features .Just right click from the editor content ---> Open With ---> Other ---> Internal Editors , and choose the editor with the template feature (eg Ant Editor) .Then , you can use the template files setup in that editor