Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load bundle only once if the same bundle occurs multiple times in different locations #1174

Merged
merged 2 commits into from
Sep 11, 2019

Conversation

jdneo
Copy link
Contributor

@jdneo jdneo commented Sep 11, 2019

When JDT.LS load the same bundle from different locations (This may occur when two extensions register the same bundle in the package.json but the file locations are different), we need to make sure that bundle only gets loaded once. Otherwise, the bundle will be uninstalled, which is an unexpected behavior.

Signed-off-by: Sheng Chen [email protected]

@@ -92,6 +126,11 @@ public static void loadBundles(Collection<String> bundleLocations) throws CoreEx
String location = getBundleLocation(bundleLocation, true);

BundleInfo bundleInfo = getBundleInfo(bundleLocation);
// Since installBundle() is an async call, we use bundleInfos to act as a cache to prevent installing multiple times for a same bundle.
if (bundleInfos.contains(bundleInfo)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!bundleInfos.add(bundleInfo)){  // returns false if bundleInfo is not added because it already exists
   continue;
}

Signed-off-by: Sheng Chen <[email protected]>
@fbricon fbricon merged commit 4a483e6 into eclipse-jdtls:master Sep 11, 2019
@fbricon fbricon added this to the Mid September 2019 milestone Sep 11, 2019
@fbricon fbricon added the bug label Sep 11, 2019
@fbricon
Copy link
Contributor

fbricon commented Sep 11, 2019

Thanks @jdneo

@jdneo jdneo deleted the cs/bundle-load branch September 11, 2019 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants