def on_query_completions(self, view, prefix, locations):
        if not is_bib_buffer(view):
            return []

        current_line = get_text_to_cursor(view)[::-1]

        if current_line.startswith(prefix[::-1]):
            current_line = current_line[len(prefix):]

        result = get_completions_if_matches(
            CROSSREF_REGEX, current_line, get_cite_keys, view)

        if result:
            return result

        if not is_biblatex_buffer(view):
            return []

        return get_completions_if_matches(
                    BIBLATEX_REGEX, current_line, get_cite_keys, view) or \
            get_completions_if_matches(
                    XDATA_REGEX, current_line, get_xdata_keys, view) or \
            get_completions_if_matches(
                    ENTRY_SET_REGEX, current_line, get_entryset_keys, view) or \
            []
    def on_query_completions(self, view, prefix, locations):
        if not is_bib_buffer(view):
            return []

        # do not return completions if the cursor is inside an entry
        if view.score_selector(view.sel()[0].b, 'meta.entry.braces.bibtex') > 0:
            return []

        if is_biblatex_buffer(view):
            return (get_biblatex_completions(), sublime.INHIBIT_WORD_COMPLETIONS)

        else:
            return (get_bibtex_completions(), sublime.INHIBIT_WORD_COMPLETIONS)
    def on_query_completions(self, view, prefix, locations):
        if not is_bib_buffer(view):
            return []

        # do not return completions if the cursor is inside an entry
        if view.score_selector(view.sel()[0].b,
                               'meta.entry.braces.bibtex') > 0:
            return []

        if is_biblatex_buffer(view):
            return (get_biblatex_completions(),
                    sublime.INHIBIT_WORD_COMPLETIONS)

        else:
            return (get_bibtex_completions(), sublime.INHIBIT_WORD_COMPLETIONS)
    def on_query_completions(self, view, prefix, locations):
        if not is_bib_buffer(view):
            return []

        cursor_point = view.sel()[0].b

        # do not autocomplete if the cursor is outside an entry
        if view.score_selector(cursor_point, 'meta.entry.braces.bibtex') == 0:
            return []

        # do not autocomplete when cursor is in the citekey field
        if view.score_selector(cursor_point, 'entity.name.type.entry-key.bibtex') > 0:
            return []

        # do not autocomplete if we are already inside a field
        if view.score_selector(cursor_point, 'meta.key-assignment.bibtex') > 0:
            return []

        if is_biblatex_buffer(view):
            return (biblatex_fields, sublime.INHIBIT_WORD_COMPLETIONS)

        else:
            return (bibtex_fields, sublime.INHIBIT_WORD_COMPLETIONS)
예제 #5
0
    def on_query_completions(self, view, prefix, locations):
        if not is_bib_buffer(view):
            return []

        cursor_point = view.sel()[0].b

        # do not autocomplete if the cursor is outside an entry
        if view.score_selector(cursor_point, 'meta.entry.braces.bibtex') == 0:
            return []

        # do not autocomplete when cursor is in the citekey field
        if view.score_selector(cursor_point,
                               'entity.name.type.entry-key.bibtex') > 0:
            return []

        # do not autocomplete if we are already inside a field
        if view.score_selector(cursor_point, 'meta.key-assignment.bibtex') > 0:
            return []

        if is_biblatex_buffer(view):
            return (biblatex_fields, sublime.INHIBIT_WORD_COMPLETIONS)

        else:
            return (bibtex_fields, sublime.INHIBIT_WORD_COMPLETIONS)