code: private CompletionProvider snippetCompletion(Supplier<Stream<? extends Snippet>> snippetsSupplier) {
          return (prefix, cursor, anchor) -> {
              anchor[0] = 0;
              int space = prefix.lastIndexOf(' ');
              Set<String> prior = new HashSet<>(Arrays.asList(prefix.split(" ")));
              if (prior.contains("-all") || prior.contains("-history")) {
                  return Collections.emptyList();
              }
              String argPrefix = prefix.substring(space + 1);
              return snippetsSupplier.get()
                          .filter(k -> !prior.contains(String.valueOf(k.id()))
                                  && (!(k instanceof DeclarationSnippet)
                                       || !prior.contains(((DeclarationSnippet) k).name())))
                          .flatMap(k -> (k instanceof DeclarationSnippet)
                                  ? Stream.of(String.valueOf(k.id()) + " ", ((DeclarationSnippet) k).name() + " ")
                                  : Stream.of(String.valueOf(k.id()) + " "))
                          .filter(k -> k.startsWith(argPrefix))
                          .map(ArgSuggestion::new)
                          .collect(Collectors.toList());
          };
      }
docs: Completion based on snippet supplier