thedataking / SublimeWritingStyle

Improve your writing style with this Sublime Text package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hack to fix ST2 compatibility

jdherman opened this issue · comments

First, thanks for making this package! It has really improved my writing in LaTeX.

It looks like the package is broken for ST2 (which is fine, some error about the keywords sublime.DRAW_NO_FILL + sublime.DRAW_NO_OUTLINE). But if anyone is still using ST2, you can replace lines 52-78 of your SublimeWritingStyle.py with this:

def lazy_mark_regions(new_regions, old_regions, style_key, color_scope_name, symbol_name):
        if old_regions != new_regions or True:
            # print 'adding new regions'
            view.erase_regions(style_key)
            # name, regions, style, symbol in gutter, draw outlined
            view.add_regions(style_key, new_regions, color_scope_name, symbol_name)
        return new_regions

    # weasel words
    new_regions = find_words(settings.pattern)
    weasel_word_regions = lazy_mark_regions(
        new_regions,
        weasel_word_regions,
        'SublimeWritingStyle',
        settings.color_scope_name,
        'dot')

    # passive words
    new_regions = find_words(settings.passive_voice_pattern)
    passive_voice_regions = lazy_mark_regions(
        new_regions,
        passive_voice_regions,
        'SublimeWritingStyle-Passive',
        'string',
        'circle')

This is clearly not a sustainable fix, but it worked for me.