On Friday, February 9, 2018 at 8:43:43 AM UTC-6, Edward K. Ream wrote:

Rev e3d9636 improves js_i.starts_block as follows.  It appears to work well.

func_patterns = [
    re.compile(r'\)\s*=>\s*\{'),
    re.compile(r'\bclass\b'),
    re.compile(r'\bfunction\b'),
]

def starts_block(self, i, lines, new_state, prev_state):
    '''True if the new state starts a block.'''
    if new_state.level() <= prev_state.level():
        return False
    line = lines[i]
    for pattern in self.func_patterns:
        if pattern.search(line) is not None:
            return True
    return False

Let me know if other patterns should be included.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to