'Returns all the snippets for the given text before the cursor.
If partial is True, then get also return partial matches.'

def _snips(self, before, partial, autotrigger_only=False):

    filetypes = self.get_buffer_filetypes()[::(-1)]
    matching_snippets = defaultdict(list)
    clear_priority = None
    cleared = {}
    for (_, source) in self._snippet_sources:
        source.ensure(filetypes, cached=autotrigger_only)
    for (_, source) in self._snippet_sources:
        sclear_priority = source.get_clear_priority(filetypes)
        if ((sclear_priority is not None) and ((clear_priority is None) or (sclear_priority > clear_priority))):
            clear_priority = sclear_priority
        for (key, value) in source.get_cleared(filetypes).items():
            if ((key not in cleared) or (value > cleared[key])):
                cleared[key] = value
    for (_, source) in self._snippet_sources:
        possible_snippets = source.get_snippets(filetypes, before, partial, autotrigger_only, self._visual_content)
        for snippet in possible_snippets:
            if (((clear_priority is None) or (snippet.priority > clear_priority)) and ((snippet.trigger not in cleared) or (snippet.priority > cleared[snippet.trigger]))):
                matching_snippets[snippet.trigger].append(snippet)
    if (not matching_snippets):
        return []
    snippets = []
    for snippets_with_trigger in matching_snippets.values():
        highest_priority = max((s.priority for s in snippets_with_trigger))
        snippets.extend((s for s in snippets_with_trigger if (s.priority == highest_priority)))
    if partial:
        return snippets
    highest_priority = max((s.priority for s in snippets))
    return [s for s in snippets if (s.priority == highest_priority)]
