<commit_before># encoding: utf-8

import sublime, sublime_plugin
try:
    from . import util
except ValueError:
    import util


class PerformEventListener(sublime_plugin.EventListener):
    """Suggest subroutine completions for the perform statement."""

    def on_query_completions(self, view, prefix, points):
        if not util.is_natural_file(view):
            return None
        texts = util.text_preceding_points(view, points)
        if all([text.strip().endswith('perform') for text in texts]):
            subroutines = util.find_text_by_selector(view,
                'entity.name.function.natural')
            if not subroutines:
                return None
            subroutines.sort()
            completions = [(sub, sub) for sub in subroutines]
            return (completions, sublime.INHIBIT_WORD_COMPLETIONS)


class AddRulerToColumn72Listener(sublime_plugin.EventListener):
    """Add a ruler to column 72 when a Natural file is opened. If the user has
    other rulers, they're not messed with."""

    def on_load(self, view):
        if not util.is_natural_file(view):
            return
        rulers = view.settings().get('rulers')
        if 72 not in rulers:
            rulers.append(72)
            rulers.sort() # why? to be neat.
            view.settings().set('rulers', rulers)

<commit_msg>Ignore case of pErFoRm when suggesting completions<commit_after># encoding: utf-8

import sublime, sublime_plugin
try:
    from . import util
except ValueError:
    import util


class PerformEventListener(sublime_plugin.EventListener):
    """Suggest subroutine completions for the perform statement."""

    def on_query_completions(self, view, prefix, points):
        if not util.is_natural_file(view):
            return None
        texts = util.text_preceding_points(view, points)
        if all([text.strip().lower().endswith('perform') for text in texts]):
            subroutines = util.find_text_by_selector(view,
                'entity.name.function.natural')
            if not subroutines:
                return None
            subroutines.sort()
            completions = [(sub, sub) for sub in subroutines]
            return (completions, sublime.INHIBIT_WORD_COMPLETIONS)


class AddRulerToColumn72Listener(sublime_plugin.EventListener):
    """Add a ruler to column 72 when a Natural file is opened. If the user has
    other rulers, they're not messed with."""

    def on_load(self, view):
        if not util.is_natural_file(view):
            return
        rulers = view.settings().get('rulers')
        if 72 not in rulers:
            rulers.append(72)
            rulers.sort() # why? to be neat.
            view.settings().set('rulers', rulers)


{'fraction_non_alphanumeric': 0.09184802655846551, 'fraction_numerical': 0.0066396163777203985, 'mean_word_length': 2.5873015873015874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3537481', 'n_tokens_mistral': 819, 'n_tokens_neox': 762, 'n_words': 220}