Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ The following settings are supported:
* `java.import.gradle.java.home`: Specifies the location to the JVM used to run the Gradle daemon.
* `java.project.resourceFilters`: Excludes files and folders from being refreshed by the Java Language Server, which can improve the overall performance. For example, ["node_modules","\.git"] will exclude all files and folders named 'node_modules' or '.git'. Pattern expressions must be compatible with `java.util.regex.Pattern`. Defaults to ["node_modules","\.git"].
* `java.templates.fileHeader`: Specifies the file header comment for new Java file. Supports configuring multi-line comments with an array of strings, and using ${variable} to reference the [predefined variables](https://github.com/redhat-developer/vscode-java/wiki/Predefined-Variables-for-Java-Template-Snippets).
* `java.templates.methodBody`: Specifies the method body snippet for unimplemented methods (e.g. generated by "Add unimplemented methods"). Supports configuring multi-line content with an array of strings, and using ${variable} to reference the [predefined variables](https://github.com/redhat-developer/vscode-java/wiki/Predefined-Variables-for-Java-Template-Snippets).
* `java.templates.methodBodySuper`: Specifies the method body snippet for overridden methods that call `super` (e.g. generated by "Override/Implement Methods"). Supports configuring multi-line content with an array of strings, and using ${variable} to reference the [predefined variables](https://github.com/redhat-developer/vscode-java/wiki/Predefined-Variables-for-Java-Template-Snippets).
* `java.templates.catchBody`: Specifies the catch block body snippet (e.g. generated by "Surround with try/catch"). Supports configuring multi-line content with an array of strings, and using ${variable} to reference the [predefined variables](https://github.com/redhat-developer/vscode-java/wiki/Predefined-Variables-for-Java-Template-Snippets).
* `java.templates.typeComment`: Specifies the type comment for new Java type. Supports configuring multi-line comments with an array of strings, and using ${variable} to reference the [predefined variables](https://github.com/redhat-developer/vscode-java/wiki/Predefined-Variables-for-Java-Template-Snippets).
* `java.templates.newFile.enabled` : Enable/disable automatic generation of class body and package declaration when creating a new Java file. Set to `false` to create empty Java files. Defaults to `true`.
* `java.references.includeAccessors`: Include getter, setter and builder/constructor when finding references. Default to true.
Expand Down
4 changes: 4 additions & 0 deletions document/_java.templateVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ Below are the predefined variables you could use in the template settings such a
- `${day}` - current day of the month
- `${hour}` - current hour
- `${minute}` - current minute
- `${todo}` - the configured task tag (e.g. "TODO")
- `${enclosing_method}` - name of the method being implemented or overridden
- `${body_statement}` - the generated body statement (e.g. a call to the overridden `super` method)
- `${exception_var}` - name of the caught exception variable
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,36 @@
"default": [],
"order": 20
},
"java.templates.methodBody": {
"type": "array",
"markdownDescription": "Specifies the method body snippet for unimplemented methods (e.g. generated by \"Add unimplemented methods\"). Supports configuring multi-line content with an array of strings, and using ${variable} to reference the [predefined variables](command:_java.templateVariables).",
"scope": "window",
"default": [
"// ${todo} Auto-generated method stub",
"throw new UnsupportedOperationException(\"Unimplemented method '${enclosing_method}'\");"
],
"order": 30
},
"java.templates.methodBodySuper": {
"type": "array",
"markdownDescription": "Specifies the method body snippet for overridden methods that call `super` (e.g. generated by \"Override/Implement Methods\"). Supports configuring multi-line content with an array of strings, and using ${variable} to reference the [predefined variables](command:_java.templateVariables).",
"scope": "window",
"default": [
"// ${todo} Auto-generated method stub",
"${body_statement}"
],
"order": 31
},
"java.templates.catchBody": {
"type": "array",
"markdownDescription": "Specifies the catch block body snippet (e.g. generated by \"Surround with try/catch\"). Supports configuring multi-line content with an array of strings, and using ${variable} to reference the [predefined variables](command:_java.templateVariables).",
"scope": "window",
"default": [
"// ${todo} Auto-generated catch block",
"${exception_var}.printStackTrace();"
],
"order": 32
},
"java.codeGeneration.insertionLocation": {
"type": "string",
"enum": [
Expand Down
Loading