def init_completion(self): provider = self.completion_provider if not hasattr(self.editor.buffer, 'python_completion_added'): add_completion_provider(self.editor.buffer, provider, 100) self.editor.buffer.python_completion_added = True attach_completer(self.editor.view)
def buffer_opened(buf): if 'not_initialized' in existing_snippet_contexts: existing_snippet_contexts.clear() discover_snippet_contexts() if not any(ctx in existing_snippet_contexts for ctx in buf.contexts): return prior = 50 contexts = [c for c in buf.contexts if c in existing_snippet_contexts] buf.snippet_contexts = contexts for ctx in contexts: if ctx not in loaded_snippets: load_snippets_for(ctx, prior) prior -= 1 add_completion_provider(buf, *completion_providers[ctx]) buf.connect_after('changed', on_buffer_changed)