Bot code detection on non-code-boxes or files
A possible improvement for the code-detection feature is to make it recognize code snippets in plain text messages, not only in files or pre-formatted code blocks.
This would save time and effort for both the helpers and the users who need help with their code. Instead of instructing the users how to format their code properly, the bot could automatically suggest them to do so when they send their code as plain text.
Here for example the code is already formatted by the user:
And the bot still recommends to format it:
But now if the code is not formatted and is just plain text, the bot does not recommend to formatt it:
Of course i do talk more about the highlight and not the line breaks because that it more important to read the code easy
valid suggestion, but unsure how you would detect such code. its not trivial at all and we had attempts to do so in the past, but it wasnt really giving good results.
instead, we added the code-actions command (right click a message, select code-actions). that spawns the format-dialog on-demand.
also note that the dialog is not only suggesting format. it will (soon) also suggest running code. so it should not only be spawned on badly formatted code, but on any code snippet
Well we could create a small parser that validates the token-combinations, identifies the code boundaries, and uses the rest of the text as a header
It has been attempted already with unsatisfying results. But sure, its valid and someone can feel free to attempt it.