-
Notifications
You must be signed in to change notification settings - Fork 650
Customize the Relative Folder and the File Name of the Problem File
The extension provides a flexible way to let the users customize the output file path of the problem files. You can achieve that by using the setting leetcode.filePath
. For example:
"leetcode.filePath": {
"default": {
// relative folder path
"folder": "",
// file name
"filename": "${id}.${kebab-case-name}.${ext}"
}
}
Basically, this setting has the following schema:
"leetcode.filePath": {
"default": {
"folder": "",
"filename": "${id}.${kebab-case-name}.${ext}"
},
"<language>": {
"folder": "<relative folder path>",
"filename": "<file name template>"
},
"<language>": {
"folder": "<relative folder path>",
"filename": "<file name template>"
},
...
}
If you have set a specified "<language>"
in this setting, then the extension will honor that if a problem file is generated in that language, otherwise the extension will fallback to the "default"
. Now the following language are supported:
- bash
- c
- cpp
- csharp
- golang
- java
- javascript
- kotlin
- mysql
- php
- python
- python3
- ruby
- rust
- scala
- swift
You can customize the output folder name by setting the folder
field. Some special variables can be used here, which the extension will dynamically resolve them:
-
${tag}
: The tag of the problem. -
${language}
: The language you are using. -
${difficulty}
: The difficulty of the problem. -
${company}
: The company of the problem.
For example:
"folder": "${tag}-${difficulty}"
You can also customize the output folder name by setting the filename
field. Some special variables can be used here, which the extension will dynamically resolve them:
-
${id}
: The ID of the problem. -
${name}
: The original name of the problem. -
${camelCaseName}
: The name of the problem but in camel case, e.g.:leetCode
-
${PascalCaseName}
: The name of the problem but in pascal case, e.g.:LeetCode
-
${kebab-case-name}
: The name of the problem but in kebab case, e.g.:leet-code
-
${snake_case_name}
: The name of the problem but in snake case, e.g.:leet_code
-
${ext}
: The extension name of the language you are using. -
${tag}
: The tag of the problem. -
${language}
: The language you are using. -
${difficulty}
: The difficulty of the problem. -
${company}
: The company of the problem.
For example:
"filename": "${id}-${kebab-case-name}.${ext}"