From e639c67d9859ee402c43a950d49a81ed502e1a08 Mon Sep 17 00:00:00 2001 From: Evie Lau Date: Tue, 3 Oct 2023 13:43:04 -0500 Subject: [PATCH] Simplify env file matching, now that LCLS handles it --- .../tools/intellij/liberty/lsp/ServerEnvFileType.java | 11 +---------- .../intellij/liberty/lsp/ServerEnvSubstitutor.java | 11 +---------- .../io/openliberty/tools/intellij/util/Constants.java | 4 +--- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvFileType.java b/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvFileType.java index d4cbdffdc..ccd523ee7 100644 --- a/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvFileType.java +++ b/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvFileType.java @@ -9,11 +9,6 @@ *******************************************************************************/ package io.openliberty.tools.intellij.liberty.lsp; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.PathMatcher; -import java.nio.file.Paths; - import javax.swing.Icon; import com.intellij.openapi.fileTypes.PlainTextLanguage; @@ -27,8 +22,6 @@ import io.openliberty.tools.intellij.LibertyPluginIcons; -import static io.openliberty.tools.intellij.util.Constants.SERVER_ENV_GLOB_PATTERN; - /** * Custom file type for server.env files */ @@ -43,9 +36,7 @@ private ServerEnvFileType() { @Override public boolean isMyFileType(@NotNull VirtualFile file) { - Path path = Paths.get(file.getPath()); - final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + SERVER_ENV_GLOB_PATTERN); - return matcher.matches(path); + return file.getPath().endsWith(".env"); } @Override diff --git a/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvSubstitutor.java b/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvSubstitutor.java index ba3751455..f1ff61760 100644 --- a/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvSubstitutor.java +++ b/src/main/java/io/openliberty/tools/intellij/liberty/lsp/ServerEnvSubstitutor.java @@ -21,13 +21,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.PathMatcher; -import java.nio.file.Paths; - -import static io.openliberty.tools.intellij.util.Constants.SERVER_ENV_GLOB_PATTERN; - /** * Language Substitutor for Liberty server.env files * To re-use the IntelliJ parsing for Properties files on server.env files, categorize server.env files that are in a recognized @@ -47,8 +40,6 @@ public class ServerEnvSubstitutor extends LanguageSubstitutor { } private boolean isLibertyServerEnvFile(VirtualFile file) { - Path path = Paths.get(file.getPath()); - final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + SERVER_ENV_GLOB_PATTERN); - return matcher.matches(path); + return file.getPath().endsWith(".env"); } } diff --git a/src/main/java/io/openliberty/tools/intellij/util/Constants.java b/src/main/java/io/openliberty/tools/intellij/util/Constants.java index 000b800b8..ddd078de4 100644 --- a/src/main/java/io/openliberty/tools/intellij/util/Constants.java +++ b/src/main/java/io/openliberty/tools/intellij/util/Constants.java @@ -83,10 +83,8 @@ public final class Constants { }); /** - * Constants for langauge servers + * Constants for language servers */ - public static final String SERVER_ENV_GLOB_PATTERN = "**/*.env"; - public static final String LIBERTY_XML_SERVER = "LemMinX"; public static final String LIBERTY_CONFIG_SERVER="Liberty Config"; public static final String JAKARTA_LANG_SERVER="Eclipse LSP4Jakarta";