def on_query_completions(self, view, prefix, locations): default_completions = [(item + "\tDefault", item) for sublist in [view.extract_completions(prefix)] for item in sublist if len(item) > 3] default_completions = list(set(default_completions)) line_region = view.line(sublime.Region(locations[0])) line = str(view.substr(line_region))[:locations[0] - line_region.a] completions = [(x, x) for x in auto_complete.get_completions(line)] completions.extend(default_completions) return (completions, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)
def test_get_completions_with_partial_match_of_child_ns(self): self.assertEquals(["ns11", "ns12"], auto_complete.get_completions("ns1.ns"))
def test_get_completions_with_partial_match_of_root_ns(self): self.assertEquals(["ns1"], auto_complete.get_completions("n"))
def test_get_completions_with_full_match_of_long_ns(self): self.assertEquals(["ns121", "ns122"], auto_complete.get_completions("ns1.ns12"))
def test_get_completions_with_full_match_of_single_ns(self): self.assertEquals(["ns11", "ns12"], auto_complete.get_completions("ns1"))
def test_get_completions_with_no_match(self): self.assertEquals([], auto_complete.get_completions("nomatch"))