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

Add automatic boilerplate code for other languages #3

Open
brtwrst opened this issue Jul 16, 2020 · 8 comments
Open

Add automatic boilerplate code for other languages #3

brtwrst opened this issue Jul 16, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@brtwrst
Copy link
Collaborator

brtwrst commented Jul 16, 2020

We have automatic boilerplate code for java snippets but there are other languages that could use this functionality as well.

Identify a language that requires some boilerplate code added every time and extend the codeswap.py file with automatic boilerplate for that language if it is not already present in the entered code.

Example:
when you want to run C code like this:

#include <stdio.h>
printf("hello word!");

it will not work because it needs main() {}
make it so that it is automatically added and the code will be interpreted as

#include <stdio.h>
int main() {
  printf("hello word!");
}
@brtwrst brtwrst added enhancement New feature or request Hacktoberfest labels Jul 16, 2020
@brtwrst
Copy link
Collaborator Author

brtwrst commented Aug 4, 2020

Rust boilerplate was added by @UsairimIsani

@brtwrst
Copy link
Collaborator Author

brtwrst commented Jan 26, 2021

Boilerplate code now exists for

  • java
  • rust
  • cpp
  • go
  • csharp

@brainplot
Copy link

Can I work on this? What are the files I should look at where this feature is implemented?

@brtwrst
Copy link
Collaborator Author

brtwrst commented Apr 24, 2021

What languages do you think can benefit from boilerplate code?

The replacement happens here: https://github.com/engineer-man/piston-bot/blob/master/src/cogs/utils/codeswap.py

@brainplot
Copy link

brainplot commented Apr 24, 2021

I had a look at the list of supported languages and I have to admit, a good part of them I do not know.
However, from the ones I do know, I think Kotlin could benefit from the same treatment as Java snippets and PHP may have the <?php ... ?> thing automatically added, if absent. Besides of course C and C++, which were discussed in this issue.

What do you think?

@brtwrst
Copy link
Collaborator Author

brtwrst commented Apr 24, 2021

C and CPP is already there.

Feel free to add anything you think will help - Kotlin seems like a good candidate.

@brainplot
Copy link

C and CPP is already there.

I would like to add the automatic addition of #include/import directives (depending on the language). This issue states it's still a missing feature. Was it added and this issue is no longer relevant or is it still a missing feature?

@Brikaa
Copy link
Member

Brikaa commented Oct 7, 2021

Basic and Fsharp.net would need to be added

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

3 participants