From 389e006c00fe50aac98c7ca9e3cbdee6dab2e35e Mon Sep 17 00:00:00 2001 From: Zane Shelby Date: Mon, 30 Nov 2020 07:50:56 -0500 Subject: [PATCH] feat(java): Show Java module for Clojure projects (#966) --- docs/config/README.md | 4 ++-- src/modules/java.rs | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/config/README.md b/docs/config/README.md index 621b194a..6d6547d8 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -1336,8 +1336,8 @@ disabled = false The `java` module shows the currently installed version of Java. The module will be shown if any of the following conditions are met: -- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt` or `.java-version` file -- The current directory contains a file with the `.java`, `.class`, `.gradle` or `.jar` extension +- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `.deps.edn`, `project.clj`, or `build.boot` file +- The current directory contains a file with the `.java`, `.class`, `.gradle`, `.jar`, `.clj`, or `.cljc` extension ### Options diff --git a/src/modules/java.rs b/src/modules/java.rs index e06182e3..2731bf6d 100644 --- a/src/modules/java.rs +++ b/src/modules/java.rs @@ -11,13 +11,21 @@ const JAVA_VERSION_PATTERN: &str = "(?P[\\d\\.]+)[^\\s]*\\s(?:built|fro /// Creates a module with the current Java version /// /// Will display the Java version if any of the following criteria are met: -/// - Current directory contains a file with a `.java`, `.class`, `.gradle` or `.jar` extension -/// - Current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt` or `.java-version` file +/// - Current directory contains a file with a `.java`, `.class`, `.jar`, `.gradle`, `.clj`, or `.cljc` extension +/// - Current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `deps.edn`, `project.clj`, or `build.boot` file pub fn module<'a>(context: &'a Context) -> Option> { let is_java_project = context .try_begin_scan()? - .set_files(&["pom.xml", "build.gradle.kts", "build.sbt", ".java-version"]) - .set_extensions(&["java", "class", "jar", "gradle"]) + .set_files(&[ + "pom.xml", + "build.gradle.kts", + "build.sbt", + ".java-version", + "deps.edn", + "project.clj", + "build.boot", + ]) + .set_extensions(&["java", "class", "jar", "gradle", "clj", "cljc"]) .is_match(); if !is_java_project {