@Override
  public void addCompletions(CompletionParameters parameters, CompletionResultSet result) {
    int endOffset = parameters.getOffset();
    Editor editor = parameters.getEditor();
    CharSequence sequence = editor.getDocument().getImmutableCharSequence();
    for (TextMateSnippet snippet : getAvailableSnippets(editor)) {
      CharSequence prefix = getPrefixForSnippet(sequence, endOffset, snippet);
      if (prefix != null && StringUtil.startsWith(snippet.getKey(), prefix)) {
        result.withPrefixMatcher(result.getPrefixMatcher().cloneWithPrefix(prefix.toString()))
          .addElement(new TextMateSnippetLookupElement(snippet));
      }
    }
  }
@Override
  public void addCompletions(CompletionParameters parameters, CompletionResultSet result)