Add gitignore for VS Code

See gh-864
This commit is contained in:
Govinda
2019-02-16 21:09:28 +05:30
committed by Stephane Nicoll
parent fdb7493ee8
commit c5f0b835e0
3 changed files with 13 additions and 2 deletions

View File

@@ -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.
*/ */

View 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;
} }

View File

@@ -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