benfry / processing4

Processing 4.x releases for Java 17
https://processing.org
Other
1.34k stars 239 forks source link

Autocomplete brackets and parenthesis #412

Open Aviii06 opened 2 years ago

Aviii06 commented 2 years ago
## Description

Currently the code editor of the processing doesn't allow even an option to autocomplete curly braces. I think there should atleast be an option for the same.

Expected Behavior

if we write void setup(then the parentesis should close. Further void setup(){ the curly brace should close with proper indentation.

Current Behavior

Currently you have to manually close every single bracket. Which gets extremly annoying for people who regularly code in vs code. Even though you can have a vs code setup by coding in vs code and have processing run through terminal I feel an option should be given. know similar discussions have been had on P5 and the result was it would be problematic for beginners. But we can still have this as an option.

Steps to Reproduce

  1. Use any parenthesis or curly braces

Your Environment

Possible Causes / Solutions

We can have a boolean in prefrences.txt and just have a function which first checks for the boolean and auto completes.

Aviii06 commented 2 years ago

Maybe we can re-write this as

text += giveMatchingBracket(text, text.length() - 1);
document.insertString(0,text,null);

where giveMatchingBracket() does similar things to this, but instead returns the mathcing bracket.