-
-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Intro
We have a code formatter side project, example usage:
String input = "..."; // some code
Lexer lexer = new Lexer();
Formatter formatter = new Formatter();
String result = formatter.format(input, lexer);
System.out.println(result); // nicely formattedWe should finally attach this functionality to the code base.
UX
It could be a message context command for starters, but even better could be if we auto-detect code and then send some sort of message with buttons:
Code detected. Here are some tools:
[Run] [Format] [View Bytecode]
For now, only the [Format] button would be there.
Care must be taken to only run the formatter on actual code, so we have to detect and extract contents of code-blocks ```java ... ```. The #207 PR can be checked for a REGEX to do so.
When the button is clicked, the bot would send a message with the formatted code.
It would also be cool if the message auto-updates whenever the original code was edited (see #207 which does that as well).
Code style
The Formatter project is in a rough shape right now and the whole project needs serious improvements. This should be done by someone familiar with clean coding techniques, its not trivial.