vscode-leetcode icon indicating copy to clipboard operation
vscode-leetcode copied to clipboard

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

Open Wang-Ji20 opened this issue 1 year ago • 4 comments

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.

Wang-Ji20 avatar Aug 24 '24 12:08 Wang-Ji20

where add this schema,pls?

HopoZ avatar Sep 02 '24 12:09 HopoZ

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.

Wang-Ji20 avatar Sep 02 '24 12:09 Wang-Ji20

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,https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/469#issuecomment-612738161

HopoZ avatar Sep 02 '24 13:09 HopoZ

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.

Wang-Ji20 avatar Sep 02 '24 13:09 Wang-Ji20