de-jcup / eclipse-jenkins-editor

Jenkins Editor - A eclipse plugin to edit "Jenkinsfile" files
https://marketplace.eclipse.org/content/jenkins-editor
Apache License 2.0
45 stars 5 forks source link

Let plugin use Jenkinsfile.groovy scripts aswell #68

Open midikem opened 5 years ago

midikem commented 5 years ago

As it is now its only used if the file is named: "It is a eclipse plugin to edit jenkins files named as Jenkinsfile, .jenkinsfile or .jenkins to handle jenkins pipeline builds." I want the plugin to recognize groovy files aswell. So if the name is Jenkinsfile.groovy I want to use the plugin.

The reason for this is that I want to make it possible for code completion in eclipse with both jenkinsfile syntax and groovy/java syntax in the same file. The only way to get the jenkins syntax in eclipse is with this plugin. My workaround to get groovy code completion to work in Jenkinsfile is to rename them to .groovy but then I dont get the code completion for Jenkinsfiles.

de-jcup commented 5 years ago

Hello @midikem ,

I am not sure if I should provide support for opening any *.groovy file. But maybe I should, because at least groovy parse errors and some other stuff do work there.

But you can define this by yourself! At https://github.com/de-jcup/eclipse-jenkins-editor/wiki/FAQ#when-not-using-jenkins-or-jenkinsfile-as-file-extension

it is explained how to setup this inside your eclipse instance - there are two ways doing this described there.

midikem commented 5 years ago

Well in the script tag basically everything in groovy should work. Also in methods everything in groovy should work.

Tried to get the *.groovy to recognize JenkinsEditor with that guide, but did not get it to work. Dont know why! I guess it could only use one editor at the time?

midikem commented 5 years ago

Maybe the real question here is if its possible to use the Jenkins Editor together with the Groovy Editor to get autocomplete to work with both Jenkinsfile and groovy. I can get Jenkinsfile autocomple to work in Jenkinsfile and I get groovy autocomple to work in *.groovy files, but I cant get them both to work in the same file.

de-jcup commented 5 years ago

Jenkins editor uses internally parts from https://github.com/de-jcup/egradle which contains a minimal groovy editor (syntax highlighting, parser error detection , etc.). It is designed to provide auto completion for descrip

An integration of groovy editor is not planned (and I have currently no idea how to do such an approach).

At the moment I have not time to develop further groovy features for egradle based groovy editors.

At the FAQ I wrote a workaround by dividing the groovy and jenkinsfile parts please ready my suggestion at https://github.com/de-jcup/eclipse-jenkins-editor/wiki/FAQ#why-is-auto-completion-only-supported-for-declarative-scripting-dsl-and-existing-words