Skip to content

Commit

Permalink
Simplify env file matching, now that LCLS handles it
Browse files Browse the repository at this point in the history
  • Loading branch information
evie-lau committed Oct 3, 2023
1 parent 7381937 commit e639c67
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
*/
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit e639c67

Please sign in to comment.