How to debug in Processing Development Environment (PDE), Also is there a plugin to support intellisense

狂风中的少年 提交于 2020-02-27 22:14:10

问题


I am new to Processing development environment, I did my homework and all I found is to import processing libraries into Java IDE (eclipse) and use debugging, I am wondering if there is a PDE plugin that can help with intellisense and debugging as for small sketches PDE is very convenient.


回答1:


Debugging

Since the launch of Processing 3, debugging is now a native feature of the Processing IDE.

In the screenshot below, you'll see a new Debug menu. I set breakpoints on the setup() and draw() methods as indicated by the <> marks in the line numbers. To the right is a popout window listing variable and object values, etc.

Intellisense

From the Preferences menu, check the box Code completion with Ctrl-space.

Then, you can start typing a function like ellipse and press CTRL+Space to pop intellisense. Moreover, with that turned on, accessing properties or methods of an object by typing a . after should automatically pop intellisense.

Using Another IDE

Finally, you could take advantage of a more powerful IDE by importing the processing core.jar into any Java project. The core.jar file is located relative to your Processing installation, such as:

OSX: /Applications/Processing 3.0.1.app/Contents/Java/core/library/core.jar
Windows: \Program Files\processing-3.0.2\core\library\core.jar

In Processing 1 and 2, this must be run as Applet. In Processing 3, run as Java Application. Here's an example to demonstrate:

import processing.core.*;

public class Main extends PApplet {

    // In Eclipse, run this project as Java Application (not Applet)
    public static void main(String[] args) {
        String[] a = {"MAIN"};
        PApplet.runSketch(a, new Main());
    }

    public void settings() { // <-- that's different
        size(500, 500); // necessary here to prevent runtime IllegalStateException
    }

    public void setup() {
        // other one and done operations
    }

    public void draw() {
        ellipse(mouseX, mouseY, 40, 40);
    }
}

Check out this post if you want to write Processing code in Eclipse across multiple classes.
https://processing.org/tutorials/eclipse/




回答2:


Unfortunately you can't get those features within the compact Processing development environment.

You can get autocompletion/intellisense with a decent Java IDE like IntelliJ or eclipse. Personally I'm pretty happy with how the Proclipsing eclipse plugin integrates with Processing (easy project export, library management, etc.)

Check out this video guide on setting up:




回答3:


If you use the latest Processing 2.0b7 version, and enable the 'EXPERIMENTAL' mode (top right corner), you have access to a small set of tools (breakpoints, step by step) and a realtime debugging console. It can't compare to other platforms such as VS or Eclipse, but it is a good start and gets some of the work done.




回答4:


I've never tried, but for Processing 2.x there is this tool for debugging. It has been discussed in this topic in procesing forum.



来源:https://stackoverflow.com/questions/14846264/how-to-debug-in-processing-development-environment-pde-also-is-there-a-plugin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!