diff --git a/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml b/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml index 6e01405b7..25b337b19 100644 --- a/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml +++ b/eclipse-language-servers/org.springframework.tooling.boot.ls/plugin.xml @@ -51,8 +51,8 @@ + file-names="application.yml,bootstrap.yml,application-dev.yml,application.yaml,bootstrap.yaml,application-dev.yaml" + file-patterns="application-*.yml,application-*.yaml"> diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/value/ValuePropertyReferencesProvider.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/value/ValuePropertyReferencesProvider.java index 6011836aa..027740621 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/value/ValuePropertyReferencesProvider.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/value/ValuePropertyReferencesProvider.java @@ -35,6 +35,7 @@ import org.eclipse.lsp4j.Position; import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.WorkspaceFolder; import org.springframework.ide.vscode.boot.java.handlers.ReferenceProvider; +import org.springframework.ide.vscode.boot.properties.BootPropertiesLanguageServerComponents; import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; import org.springframework.ide.vscode.commons.util.BadLocationException; import org.springframework.ide.vscode.commons.util.text.TextDocument; @@ -132,23 +133,30 @@ public class ValuePropertyReferencesProvider implements ReferenceProvider { } private boolean isPropertiesFile(Path path) { - Path fileName = path.getFileName(); + String fileName = path.getFileName().toString(); - if (fileName.toString().endsWith(".properties") || path.toString().endsWith(".yml")) { - return fileName.toString().contains("application"); - } - else { - return false; + if (fileName.endsWith(BootPropertiesLanguageServerComponents.PROPERTIES)) { + return fileName.contains("application"); + } else { + for (String yml : BootPropertiesLanguageServerComponents.YML) { + if (fileName.endsWith(yml)) { + return fileName.contains("application"); + } + } } + return false; } private List findReferences(Path path, String propertyKey) { String filePath = path.toString(); - if (filePath.endsWith(".properties")) { + if (filePath.endsWith(BootPropertiesLanguageServerComponents.PROPERTIES)) { return findReferencesInPropertiesFile(filePath, propertyKey); - } - else if (filePath.endsWith(".yml")) { - return findReferencesInYMLFile(filePath, propertyKey); + } else { + for (String yml : BootPropertiesLanguageServerComponents.YML) { + if (filePath.endsWith(yml)) { + return findReferencesInYMLFile(filePath, propertyKey); + } + } } return new ArrayList(); } diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/properties/BootPropertiesLanguageServerComponents.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/properties/BootPropertiesLanguageServerComponents.java index 29b6428c4..32303e992 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/properties/BootPropertiesLanguageServerComponents.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/properties/BootPropertiesLanguageServerComponents.java @@ -55,8 +55,8 @@ import com.google.common.collect.ImmutableSet; */ public class BootPropertiesLanguageServerComponents implements LanguageServerComponents { - private static final String YML = ".yml"; - private static final String PROPERTIES = ".properties"; + public static final String[] YML = {".yml", ".yaml" } ; + public static final String PROPERTIES = ".properties"; private static final Set LANGUAGES = ImmutableSet.of( LanguageId.BOOT_PROPERTIES, @@ -135,8 +135,12 @@ public class BootPropertiesLanguageServerComponents implements LanguageServerCom if (uri!=null) { if (uri.endsWith(PROPERTIES)) { return propertiesCompletions.getCompletions(document, offset); - } else if (uri.endsWith(YML)) { - return yamlCompletions.getCompletions(document, offset); + } else { + for (String yml : YML) { + if (uri.endsWith(yml)) { + return yamlCompletions.getCompletions(document, offset); + } + } } } return ImmutableList.of(); @@ -153,8 +157,12 @@ public class BootPropertiesLanguageServerComponents implements LanguageServerCom if (uri!=null) { if (uri.endsWith(PROPERTIES)) { return propertiesHovers.getHoverInfo(document, offset); - } else if (uri.endsWith(YML)) { - return ymlHovers.getHoverInfo(document, offset); + } else { + for (String yml : YML) { + if (uri.endsWith(yml)) { + return ymlHovers.getHoverInfo(document, offset); + } + } } } return null; @@ -170,9 +178,13 @@ public class BootPropertiesLanguageServerComponents implements LanguageServerCom if (uri.endsWith(PROPERTIES)) { propertiesReconciler.reconcile(doc, problemCollector); return; - } else if (uri.endsWith(YML)) { - ymlReconciler.reconcile(doc, problemCollector); - return; + } else { + for (String yml : YML) { + if (uri.endsWith(yml)) { + ymlReconciler.reconcile(doc, problemCollector); + return; + } + } } } //No real reconciler is applicable. So tell the problemCollector there are no problems.