Exemplo n.º 1
0
def create_completion(view, backward, word = r'[\w\-]+$',
  search = r'(?:[^\w]|^)(__WORD__[\w\-]*\w)'):

  completions, words, word = utility.initiate_completions(view, word)
  if word == None:
    return None

  text, point_range, shift = utility.get_text(view, backward)

  for match in utility.find_matches(text, backward, search, word):
    completion = utility.get_completion(completions, words, match.group(1))
    utility.append_region(completion, point_range, shift, match.start(1),
      match.end(1))

  return completions
Exemplo n.º 2
0
def create_fuzzy_completion(view, backward, word = r'[\w\-]+$',
  delimeter = r'[\w\-]*', last_delimeter = r'[\w\-]*\w',
  search = r'(?:[^\w]|^)([_\\]*__FUZZY__)'):

  completions, words, word = utility.initiate_completions(view, word)
  if word == None:
    return None

  text, point_range, shift = utility.get_text(view, backward)

  search = _set_fuzzy_expression(search, word, delimeter, last_delimeter)

  for match in utility.find_matches(text, backward, search, word):
    completion = utility.get_completion(completions, words, match.group(1))
    utility.append_region(completion, point_range, shift, match.start(1),
      match.end(1))

  return completions
Exemplo n.º 3
0
def _append_region(view, completions, words, region):
  complete = view.substr(region)
  completion = utility.get_completion(completions, words, complete)
  utility.append_region(completion, [0, view.size()], 0, region.a, region.b)
Exemplo n.º 4
0
def _append_region(view, completions, words, region):
    complete = view.substr(region)
    completion = utility.get_completion(completions, words, complete)
    utility.append_region(completion, [0, view.size()], 0, region.a, region.b)