Processing Editor could be better

Hi,
First of all, this post isn’t meant to bash processing or the editor!
The official processing editor is sadly not the best, it’s kinda buggy and doesn’t have some good features. I know it’s complicated to make an editor, but on https://processing.org/ there is an interactive text field to change the icon, and some features like these are really great;

  • scrolling on a number to change it
  • tapping on boolean / enum to change it
  • tapping on a function to hide the things in it

some bugs are sometimes not being able to type numbers or the editor freezing while the sketch is frozen.

I would love an editor upgrade :3

1 Like

Hi @Noodlybanan,

You can post issues, feature requests, improvement suggestions here:

Cheers
— mnse

3 Likes

hi @Noodlybanan, it’s lesser known but there is a feature called tweak mode (Menu - Sketch → Tweak) to achieve this in the editor.

2 Likes

Wait, so is there also hot code reloading? Because the tweak mode is nearly that!

Not exactly hot reloading because you can’t change the code itself. But for your purpose, I guess it works!

1 Like

If you want full hot code reloading with Processing libs, you could check out PraxisLIVE. Better editor too (it’s based on the NetBeans code editor).

1 Like

In my opinion the OP is correct.

The IDE deserves more attention and looks old-fashioned.

2 Likes

This is a great question and has been the subject of much discussion and research going as far back as the mid-2000s. I’ll quote Processing’s principal maintainer Ben Fry on the topic:

The current Editor, based on the ancient JEditSyntax package has held up long past its expiration date. Exhaustive work has been done to look at replacing the component with something more modern, like RSyntaxArea, but it’s simply not feasible without breaking a massive amount of code, and likely introducing a lot of regressions in the process. All for… code folding? An incrementally better experience? But with potential for major setbacks in low-level code? It’s simply not a path that makes sense.

With that in mind, any work on updating the editor and adding new features should be focused on further adapting the preprocessor and compiler to be wrapped using the Language Server Protocol, so that we can link to other existing editors (Visual Studio Code and many others). It should be possible to create a Java-only, headless implementation that wraps the current source in this repository and can communicate via LSP.

The initial work was completed in Processing 4.1, and now needs more testing and implementation of Language Server clients such as this one.

We can start building a new PDE that’s as simple to use as the current application, based on something like Theia, a new editor platform that uses LSP as its basis.

With that in mind, nearly all editor enhancement requests will be redirected to this aim. The current editor does what we want it to, for the intended audience, and improving it requires a better foundation as a starting point.

Source: https://github.com/benfry/processing4/blob/main/CONTRIBUTING.md#editor

For a deeper understanding of the topic I highly recommend reading the following documentation:

TL;DR:

“The bottom line is that the time is better spent pursuing a different approach—a Language Server implementation and probably a lightweight (HTML/JS) GUI on top of it.” — Ben Fry

3 Likes

Why is your post deleted? you didn’t say anything bad

1 Like

I was wondering if there is a way to write your own editor, if the backend of processing is still there? Or is everything done in the editor? Meaning: Would there be an option to create a basic processing editor (just text and a run and stop button) in maybe javafx? If that would be possible easily you could create your own version of an editor.

I would never want to stifle someone else’s creativity or enthusiasm, but having written several editors I can tell you that it is not a trivial undertaking. Most things are possible if you’re willing to invest enough time and energy. I suggest you get started by learning to compile and run straight java code. You can do this with a couple of text areas, one for the code and one for the error messages, and then using ‘java’ and ‘javac’ from the command line to compile and run. Of course you won’t be using Processing for this, just raw java or javafx. If you want to take advantage of the Processing core library then Intellij might be a good place to get your feet wet. You will have to learn how to import the needed core libraries from the Processing.app, but you will have a nice editor to work in. If you still want to write your own editor after this experience go for it. Personally, I have the utmost respect for Ben Fry and his contributors. I’m relatively new to java programming and I doubt that I would be engaged in it if it were not for Processing and its editor. I rarely use my own java and javafx editors due to all the bugs that I never could resolve.

Example of gui for simple java editor:

4 Likes

I believe that the goal of the existing efforts to implement Language Server Protocol in Processing is to make it easier to integrate Processing in other development environments. To cite Ben again:

This would allow Processing to work with other editors, reducing the stress on the PDE needing to support every last detail that advanced users seek. [source]

Initial work now incorporated for Processing 4.1. (…) we don’t have an official client yet, but hopefully the community can help fill that hole for various platforms for at least the time being. [source]

So if you have the time, motivation, and skills, it may be most productive to help improve the existing LSP implementation, or prototype an LSP client for your favorite editor. See for reference:

That said, as @svan said, if you have a strong drive to build your own code editor from scratch, by any means, go ahead :smiley: I’m sure you’ll learn a lot from the experience.

3 Likes