Help creating a Tool to autoformat the code inside the Processing IDE when in Python Mode

Processing Python mode autoformat (Ctrl + T) has been broken for a long time, and it depends on a socket (?), a local network connection that can often break.

I would like someone versed on Eclipse and Processing Tool making to help make something that runs a PEP8 formatter on the IDE code contents…

UPDATE:
Let’s break the problem in 2 parts.

  1. Can someone please help me make a tool that gets the code from the IDE, runs it through a command-line (?) tool that formats it and puts it back in the IDE?
  2. Can someone help me make the CL tool or equivalent that woulp PEP8fy code on Windows, MacOS and Linux?

(For reference: this is the formatter that comes with the mode: processing.py/autopep8.py at 78a237922c2a928b83f4ad579dbf8d32c0099890 · jdf/processing.py · GitHub and also Autoformatting pains / Tool ideas?)

2 Likes

I have been using this autopep8 · PyPI based on pycodestyle, but I wish I could invoke it from the IDE on the current tab…

That should be doable, or? There are 3 wiki pages about tools, this is one of them which deletes your code: Tool Basics · processing/processing Wiki · GitHub :slight_smile:

So you can create a tool that passes the current file to autopep8, then reads and replaces the code with the result.

We’ve yet to implement shortcut assignment for contributed tools. Resolving keystroke collisions between user contributed tools and the rest of the environment is tougher than it might appear.

1 Like