Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot code detection on non-code-boxes or files #931

Open
MrMystery10-del opened this issue Oct 24, 2023 · 4 comments
Open

Bot code detection on non-code-boxes or files #931

MrMystery10-del opened this issue Oct 24, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@MrMystery10-del
Copy link

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:
Screenshot 2023-10-24 105151
And the bot still recommends to format it:
Screenshot 2023-10-24 105210

But now if the code is not formatted and is just plain text, the bot does not recommend to formatt it:
Screenshot 2023-10-24 105434

Of course i do talk more about the highlight and not the line breaks because that it more important to read the code easy

@MrMystery10-del MrMystery10-del added the enhancement New feature or request label Oct 24, 2023
@Zabuzard
Copy link
Member

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.

@Zabuzard
Copy link
Member

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

@MrMystery10-del
Copy link
Author

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

@Zabuzard
Copy link
Member

It has been attempted already with unsatisfying results. But sure, its valid and someone can feel free to attempt it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants