void (@NotNull String text, int offset, @NotNull String prefix, @NotNull CompletionResultSet result) { ParametersListLexer lexer = new ParametersListLexer(text); int argCount = 0; while (lexer.nextToken()) { if (offset < lexer.getTokenStart()) { break; } if (offset <= lexer.getTokenEnd()) { if (argCount == 0) { if (prefix.startsWith("--")) { for (Option option : myOptions.getOptions()) { if (option.getLongOpt() != null) { result.addElement(createLookupElement(option, "--" + option.getLongOpt())); } } } else if (prefix.startsWith("-")) { for (Option option : myOptions.getOptions()) { if (option.getOpt() != null) { result.addElement(createLookupElement(option, "-" + option.getOpt())); } } } else { addArgumentVariants(result); } } return; } if (argCount > 0) { argCount--; } else { String token = lexer.getCurrentToken(); if (token.startsWith("-")) { Option option = myOptions.getOption(token); if (option != null) { int optionArgCount = option.getArgs(); if (optionArgCount == Option.UNLIMITED_VALUES) { argCount = Integer.MAX_VALUE; } else if (optionArgCount != Option.UNINITIALIZED) { argCount = optionArgCount; } } } } } if (argCount > 0) { return; } addArgumentVariants(result); }