Skip to content

Commit fb52d01

Browse files
committed
fix: make sure FolderConfig is updated whenever the LsConfigurationUpdater().configurationChanged() is called
1 parent c482f2f commit fb52d01

3 files changed

Lines changed: 285 additions & 229 deletions

File tree

plugin/src/main/java/io/snyk/eclipse/plugin/properties/preferences/FolderConfigs.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package io.snyk.eclipse.plugin.properties.preferences;
22

3+
import java.util.ArrayList;
34
import java.util.List;
45

56
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
67
import org.eclipse.core.runtime.preferences.InstanceScope;
8+
import org.osgi.service.prefs.BackingStoreException;
79

810
import com.google.gson.Gson;
11+
import com.google.gson.JsonSyntaxException;
912

1013
import io.snyk.eclipse.plugin.utils.SnykLogger;
1114
import io.snyk.languageserver.protocolextension.messageObjects.FolderConfig;
15+
import io.snyk.languageserver.protocolextension.messageObjects.FolderConfigsParam;
1216

1317
public class FolderConfigs {
1418
private static FolderConfigs instance;
@@ -73,4 +77,16 @@ public void addAll(List<FolderConfig> folderConfigs) {
7377
addFolderConfig(folderConfig);
7478
}
7579
}
80+
81+
public FolderConfigsParam getFolderConfigs(List<String> folderPaths) {
82+
List<FolderConfig> folderConfigs = new ArrayList<>();
83+
for (String folderPath : folderPaths) {
84+
String json = preferenceState.get(folderPath, null);
85+
if (json != null) {
86+
FolderConfig folderConfig = gson.fromJson(json, FolderConfig.class);
87+
folderConfigs.add(folderConfig);
88+
}
89+
}
90+
return new FolderConfigsParam(folderConfigs);
91+
}
7692
}

0 commit comments

Comments
 (0)