boolean (@NotNull CompletionResultSet result, @NotNull JdkOptionsData data, int offset, @NotNull String text) { boolean booleanStart = false; if (offset > 0 && (text.charAt(offset - 1) == '+' || text.charAt(offset - 1) == '-')) { offset--; booleanStart = true; } if (!hasOptionPrefix(text, offset, "-XX:")) return false; List<LookupElement> elements = new ArrayList<>(); Set<String> existingOptions = OPTION_SEPARATOR.splitAsStream(text).map(OPTION_MATCHER::matcher) .filter(Matcher::matches).map(matcher -> matcher.group(1)).collect(Collectors.toSet()); for (VMOption option : data.getOptions()) { if (option.getVariant() != VMOptionVariant.XX) continue; if (existingOptions.contains(option.getOptionName())) continue; String type = option.getType(); LookupElementBuilder e = null; TailType tailType = null; Icon icon = option.getKind().icon(); if ("bool".equals(type)) { String lookupString = (booleanStart ? "" : Boolean.parseBoolean(option.getDefaultValue()) ? "-" : "+") + option.getOptionName(); tailType = TailTypes.spaceType(); e = LookupElementBuilder.create(option.createPointer(), lookupString); } else if (!booleanStart) { String tailText = " = " + option.getDefaultValue(); tailType = TailTypes.equalsType(); e = LookupElementBuilder.create(option.createPointer(), option.getOptionName()).withTailText(tailText, true); } if (e != null) { LookupElement element = TailTypeDecorator.withTail(e.withTypeText(type).withIcon(icon), tailType); InsertHandler<LookupElement> handler = getInsertHandler(option.getKind()); if (handler != null) { element = LookupElementDecorator.withDelegateInsertHandler(element, handler); } elements.add(element); } } result = result.withPrefixMatcher(new CamelHumpMatcher(result.getPrefixMatcher().getPrefix(), false)); result.addAllElements(elements); return true; }