diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/ExtensionsExtractor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/ExtensionsExtractor.java index 6d8b7f23a6..91722bc922 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/ExtensionsExtractor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/ExtensionsExtractor.java @@ -12,8 +12,9 @@ *******************************************************************************/ package org.eclipse.jdt.ls.core.internal; -import java.util.Arrays; import java.util.List; +import java.util.Map; +import java.util.TreeMap; import java.util.stream.Collectors; import org.eclipse.core.runtime.IConfigurationElement; @@ -26,12 +27,18 @@ * */ public class ExtensionsExtractor { - public static List extractExtensions(final String namespace, final String extensionPointName) { + public static List extractOrderedExtensions(final String namespace, final String extensionPointName) { final var extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(namespace, extensionPointName); final var configs = extensionPoint.getConfigurationElements(); - return Arrays.stream(configs).map(ExtensionsExtractor::makeExtension).collect(Collectors.toUnmodifiableList()); + Map extensionMap = new TreeMap<>(); + + for (int i = 0; i < configs.length; i++) { + Integer order = Integer.valueOf(configs[i].getAttribute("order")); + extensionMap.put(order, makeExtension(configs[i])); + } + return extensionMap.values().stream().collect(Collectors.toUnmodifiableList()); } @SuppressWarnings("unchecked") diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/BuildSupportManager.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/BuildSupportManager.java index 48d90ba462..2bdfcb30b2 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/BuildSupportManager.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/BuildSupportManager.java @@ -37,7 +37,7 @@ private BuildSupportManager() {} public static List obtainBuildSupports() { if (instance.lazyLoadedBuildSupportList == null) { - instance.lazyLoadedBuildSupportList = ExtensionsExtractor.extractExtensions(IConstants.PLUGIN_ID, "buildSupport"); + instance.lazyLoadedBuildSupportList = ExtensionsExtractor.extractOrderedExtensions(IConstants.PLUGIN_ID, "buildSupport"); } return instance.lazyLoadedBuildSupportList;