static Map<String, String> toMap(List<Settings.Setting> settingsList) {
    Map<String, String> result = new LinkedHashMap<>();
    for (Settings.Setting s : settingsList) {
      // we need the "*.file.suffixes" and "*.file.patterns" properties for language detection
      // see DefaultLanguagesRepository.populateFileSuffixesAndPatterns()
      if (!s.getInherited() || s.getKey().endsWith(".file.suffixes") || s.getKey().endsWith(".file.patterns")) {
        switch (s.getValueOneOfCase()) {
          case VALUE:
            result.put(s.getKey(), s.getValue());
            break;
          case VALUES:
            result.put(s.getKey(), s.getValues().getValuesList().stream().map(StringEscapeUtils::escapeCsv).collect(Collectors.joining(",")));
            break;
          case FIELDVALUES:
            convertPropertySetToProps(result, s);
            break;
          default:
            if (!s.getKey().endsWith(".secured")) {
              throw new IllegalStateException("Unknown property value for " + s.getKey());
            }
        }
      }
    }
    return result;
  }
@Test
  public void should_always_load_language_detection_properties() {
    assertThat(AbstractSettingsLoader.toMap(List.of(
      Setting.newBuilder()
        .setInherited(false)
        .setKey("sonar.xoo.file.suffixes")
        .setValues(Values.newBuilder().addValues(".xoo")).build(),
      Setting.newBuilder()
        .setInherited(false)
        .setKey("sonar.xoo.file.patterns")
        .setValues(Values.newBuilder().addValues("Xoofile")).build()
    ))).containsExactly(
      entry("sonar.xoo.file.suffixes", ".xoo"),
      entry("sonar.xoo.file.patterns", "Xoofile")
    );
  }