You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I create a new java file, I'm able to immediately select if I want to create a class, interface, or enum. However, there does not seem to be a way to configure what said generated type looks like. Specifically for the team I work on, there's an expectation that a certain file header comment appears at the top and specific boiler plate javadoc appears before each type.
Because this isn't possible in VSCode, I often forget to put these in there manually and thus receive embarrassing comments on my code reviews about forgetting these things. 😅
In Eclipse, I could configure the template for types and files by going to Preferences->Java->Code Style->Code Templates and control what is generated. This is what I want. (This is different from Preferences->Java->Editor->Templates which is closer to VSCode snippets).
Environment
Operating System: Windows 10
JDK version: JDK 11
Visual Studio Code version: 1.45.1
Java extension version: 0.62.0
The text was updated successfully, but these errors were encountered:
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.
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.
For instance, you can define a copyright header like:
"java.templates.fileHeader": [
"/**",
"* Copyright (c) ${year} Red Hat, Inc.",
"* All rights reserved. This program and the accompanying materials",
"* are made available under the terms of the Eclipse Public License v2.0",
"* which accompanies this distribution, and is available at",
"* http://www.eclipse.org/legal/epl-v20.html",
"*",
"* SPDX-License-Identifier: EPL-2.0",
"*/"
],
When I create a new java file, I'm able to immediately select if I want to create a class, interface, or enum. However, there does not seem to be a way to configure what said generated type looks like. Specifically for the team I work on, there's an expectation that a certain file header comment appears at the top and specific boiler plate javadoc appears before each type.
Because this isn't possible in VSCode, I often forget to put these in there manually and thus receive embarrassing comments on my code reviews about forgetting these things. 😅
In Eclipse, I could configure the template for types and files by going to Preferences->Java->Code Style->Code Templates and control what is generated. This is what I want. (This is different from Preferences->Java->Editor->Templates which is closer to VSCode snippets).
Environment
The text was updated successfully, but these errors were encountered: