Custom Java-Editor clone for Plugin #2857
-
I am currently working on an plugin for my own custom build system, which utilizes java files as the build script. But I cant find any clear documentation about how the JDT plugin is structured and how it might be possible to make these modifications to the editor.
Which creates an editor that is able to highlight the keywords in the code, but autocomplete or suggestions don't work. Maybe there is even a better way to do this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I suggest that instead of creating an Eclipse-specific editor, you consider creating a language server for your language. There is eclipse.jdt.ls project that provides a language server for Java that you may be able to leverage and configure to provide some smartness for your files; and also eclipseide-jdtls plugin that demoes how to embed JDT-LS inside the Eclipse IDE so the .java files are editable with the Generic Code Editor. This can also be mimicked by your language server. |
Beta Was this translation helpful? Give feedback.
-
As far as I know language servers are language specific, so there will be a language server for java, rust or other languages. There is nothing special about my buildscipt files, in fact, if I include the build-script project into any project containing such an buildscript file, I can edit the buildscript in the default java editor with no problems, since all classes are now in the classpath. Also, if I would create a custom language server, how would I apply it to an custom editor to get all the standard features of an java editor ? |
Beta Was this translation helpful? Give feedback.
Feel free to have a look at JDT code and suggest enhancement; however I think you can trust the dozen of people from various project (JDT, m2e, buildship...) who have all looked at this issue and all concluded that there is no such viable workaround to be found and that such case would require non-trivial, yet possible, changes in JDT Core.
However, for this case, especially if you create a particular extension/content-type, your initial idea might be more "workaround-friendly". Basically, there is the method
getInputJavaElement()
on JavaEditor and family you can override. What you will want is to build a different CompilationUnit for your case; particularly a custom CompilationUnit that …