def complete_cmdline(arglead, line, start): """ Returns completions Vim's commandline. """ try: obj = IDENTIFIER_REGEX.findall(line)[-1] except IndexError: return "[]" if "." in obj: # split into object we're looking for properties of and partial property name (which might not exist) obj, prop = (obj.rsplit(".", 1) + [""])[:2] # get leading part of completion base = "".join(arglead.rpartition(".")[:2]) else: # complete this obj, prop = "this", obj base = "" # CoffeeScript shorthands obj = obj.replace("@", "this.").replace("::", ".prototype.").strip(".") result = client.complete(obj) if result: return repr(sorted((str(base + x) for x in result if prop.lower() in x.lower()))) else: return "[]"
def complete_cmdline(arglead, line, start): ''' Returns completions Vim's commandline. ''' try: obj = IDENTIFIER_REGEX.findall(line)[-1] except IndexError: return '[]' if '.' in obj: # split into object we're looking for properties of and partial property name (which might not exist) obj, prop = (obj.rsplit('.', 1) + [''])[:2] # get leading part of completion base = ''.join(arglead.rpartition('.')[:2]) else: # complete this obj, prop = 'this', obj base = '' result = client.complete(obj) if result: return repr(sorted((str(base + x) for x in result if prop.lower() in x.lower()))) else: return '[]'
def complete(line, base, col): ''' Returns completions for Vim. ''' base = base or '' col = int(col) try: # obj = IDENTIFIER_REGEX.findall(line[:col])[-1][:-(len(base)+1)] obj = IDENTIFIER_REGEX.findall(line[:col])[0] except IndexError: return '[]' if not '.' in obj: obj, base = 'this', obj obj = obj.strip('.') result = client.complete(obj) if result: return repr(sorted((str(x) for x in result if base.lower() in x.lower()), key=lambda x: x.startswith(base))) else: return '[]'
def complete(line, base, col): """ Returns completions for Vim. """ base = base or "" col = int(col) try: obj = IDENTIFIER_REGEX.findall(line[:col])[0] except IndexError: return "[]" # CoffeeScript shorthands obj = obj.replace("@", "this.").replace("::", ".prototype.") if "." not in obj: obj, base = "this", obj obj = obj.strip(".") result = client.complete(obj) if result: return repr(sorted((str(x) for x in result if base.lower() in x.lower()), key=lambda x: x.startswith(base))) else: return "[]"