mirror of
https://gitee.com/dcren/initializr.git
synced 2025-12-17 17:41:31 +08:00
Add gitignore for VS Code
See gh-864
This commit is contained in:
@@ -39,17 +39,22 @@ public class GitIgnore {
|
|||||||
|
|
||||||
private final GitIgnoreSection netBeans = new GitIgnoreSection("NetBeans");
|
private final GitIgnoreSection netBeans = new GitIgnoreSection("NetBeans");
|
||||||
|
|
||||||
|
private final GitIgnoreSection visualStudioCode = new GitIgnoreSection(
|
||||||
|
"Visual Studio Code");
|
||||||
|
|
||||||
public void write(PrintWriter writer) throws IOException {
|
public void write(PrintWriter writer) throws IOException {
|
||||||
this.general.write(writer);
|
this.general.write(writer);
|
||||||
this.sts.write(writer);
|
this.sts.write(writer);
|
||||||
this.intellijIdea.write(writer);
|
this.intellijIdea.write(writer);
|
||||||
this.netBeans.write(writer);
|
this.netBeans.write(writer);
|
||||||
|
this.visualStudioCode.write(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return this.general.getItems().isEmpty() && this.sts.getItems().isEmpty()
|
return this.general.getItems().isEmpty() && this.sts.getItems().isEmpty()
|
||||||
&& this.intellijIdea.getItems().isEmpty()
|
&& this.intellijIdea.getItems().isEmpty()
|
||||||
&& this.netBeans.getItems().isEmpty();
|
&& this.netBeans.getItems().isEmpty()
|
||||||
|
&& this.visualStudioCode.getItems().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GitIgnoreSection getGeneral() {
|
public GitIgnoreSection getGeneral() {
|
||||||
@@ -68,6 +73,10 @@ public class GitIgnore {
|
|||||||
return this.netBeans;
|
return this.netBeans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GitIgnoreSection getVisualStudioCode() {
|
||||||
|
return this.visualStudioCode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of a section of a {@code .gitignore} file.
|
* Representation of a section of a {@code .gitignore} file.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public class GitProjectGenerationConfiguration {
|
|||||||
gitIgnore.getIntellijIdea().add(".idea", "*.iws", "*.iml", "*.ipr");
|
gitIgnore.getIntellijIdea().add(".idea", "*.iws", "*.iml", "*.ipr");
|
||||||
gitIgnore.getNetBeans().add("/nbproject/private/", "/nbbuild/", "/dist/",
|
gitIgnore.getNetBeans().add("/nbproject/private/", "/nbbuild/", "/dist/",
|
||||||
"/nbdist/", "/.nb-gradle/");
|
"/nbdist/", "/.nb-gradle/");
|
||||||
|
gitIgnore.getVisualStudioCode().add(".vscode/");
|
||||||
return gitIgnore;
|
return gitIgnore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ class GitProjectGenerationConfigurationTests {
|
|||||||
ProjectDescription description = new ProjectDescription();
|
ProjectDescription description = new ProjectDescription();
|
||||||
description.setBuildSystem(new GradleBuildSystem());
|
description.setBuildSystem(new GradleBuildSystem());
|
||||||
assertThat(generateGitIgnore(description)).contains("### STS ###",
|
assertThat(generateGitIgnore(description)).contains("### STS ###",
|
||||||
"### IntelliJ IDEA ###", "### NetBeans ###");
|
"### IntelliJ IDEA ###", "### NetBeans ###",
|
||||||
|
"### Visual Studio Code ###");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user