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

[Feature] Add a small code snippet before every problem solutions #972

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Wang-Ji20
Copy link

About

Code preamble is a short code snippet adding to the beginning of the program. A typical one is:

 #include <iostream>
 using namespace std;

This feature is useful. Maybe inserting header files is interesting for the first several times, it is dreadful if we need to add tons of it each time we do the problems, especially for a dreadful language like C/C++

Configuration

To add a preamble for one language, you can follow this schema:

 "leetcode.language.preamble" = {
      "cpp" : "#include <iostream>\n",
 }

Effect

Now you don't need to #include <iostream> everytime if you use cpp.

@HopoZ
Copy link

HopoZ commented Sep 2, 2024

where add this schema,pls?

@Wang-Ji20
Copy link
Author

where add this schema,pls?

just in preference.. You can find a setting called "leetcode.language.preamble". Then you can edit the setting in vscode.

This is only a small utility, not very complete and did not expect it to work for everyone.

@HopoZ
Copy link

HopoZ commented Sep 2, 2024

where add this schema,pls?

just in preference.. You can find a setting called "leetcode.language.preamble". Then you can edit the setting in vscode.

This is only a small utility, not very complete and did not expect it to work for everyone.

I found a more useful method,#469 (comment)

@Wang-Ji20
Copy link
Author

where add this schema,pls?

just in preference.. You can find a setting called "leetcode.language.preamble". Then you can edit the setting in vscode.
This is only a small utility, not very complete and did not expect it to work for everyone.

I found a more useful method,#469 (comment)

Thanks! So the cli provide this functionality, but the editor extension did not support it. no wonder I can't find relating configuration in the extension.

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

Successfully merging this pull request may close these issues.

2 participants