Skip to content

Commit

Permalink
update option version before merging
Browse files Browse the repository at this point in the history
Signed-off-by: Shi Chen <[email protected]>
  • Loading branch information
CsCherrYY committed Apr 13, 2023
1 parent dafe585 commit 8f0efa4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
import java.util.stream.Collectors;

import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jdt.internal.ui.preferences.formatter.ProfileVersionerCore;

public class FormatterPreferences {

private static final int CURRENT_VERSION = 23;

// @formatter:off
// < JDTLS settings, eclipse settings >
private static Map<String, String> eclipseOptions = Map.ofEntries(
Expand Down Expand Up @@ -78,13 +81,14 @@ public class FormatterPreferences {
* @return the converted eclipse formatter options
*/
public static Map<String, String> toEclipseOptions(Map<String, String> lsOptions) {
return lsOptions.entrySet().stream().filter(option -> eclipseOptions.containsKey(option.getKey())).collect(Collectors.toMap(option -> eclipseOptions.get(option.getKey()), option -> {
Map<String, String> options = lsOptions.entrySet().stream().filter(option -> eclipseOptions.containsKey(option.getKey())).collect(Collectors.toMap(option -> eclipseOptions.get(option.getKey()), option -> {
String value = option.getValue();
if (valueMap.containsKey(value)) {
return valueMap.get(value);
}
return value;
}));
return ProfileVersionerCore.updateAndComplete(options, CURRENT_VERSION);
}

/**
Expand Down

0 comments on commit 8f0efa4

Please sign in to comment.