From e693c574115f6084777c0d198376f7e353d2012a Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Mon, 20 Nov 2017 08:59:43 +0000 Subject: [PATCH 1/5] Fix completions This fixes completions so that they are not affected by this bug: https://github.com/SublimeTextIssues/Core/issues/1061 Completions triggers that contain any character not in [a-zA-Z0-9_-] cause buffers completions to block i.e. buffer completions don't work properly. Trigger descriptions use '\t' character to separate the completion from the trigger, which means they break buffer completions. There were a few other ones that had parens in the trigger too. Re: https://github.com/eliquious/Python-Auto-Complete/issues/1 --- Python.sublime-completions | 530 +++++++++++++++++++------------------ 1 file changed, 267 insertions(+), 263 deletions(-) diff --git a/Python.sublime-completions b/Python.sublime-completions index 0b47167..5665fd5 100644 --- a/Python.sublime-completions +++ b/Python.sublime-completions @@ -4,276 +4,280 @@ "completions": [ - // key words - {"trigger": "and\tkeyword", "contents": "and"}, - {"trigger": "as\tkeyword", "contents": "as"}, - {"trigger": "assert\tkeyword", "contents": "assert"}, - {"trigger": "break\tkeyword", "contents": "break"}, - {"trigger": "continue\tkeyword", "contents": "continue"}, - {"trigger": "del\tkeyword", "contents": "del"}, - {"trigger": "except\tkeyword", "contents": "except"}, - {"trigger": "exec\tkeyword", "contents": "exec"}, - {"trigger": "False\tkeyword", "contents": "False"}, - {"trigger": "finally\tkeyword", "contents": "finally"}, - {"trigger": "for\tkeyword", "contents": "for"}, - {"trigger": "in\tkeyword", "contents": "in"}, - {"trigger": "is\tkeyword", "contents": "is"}, - {"trigger": "None\tkeyword", "contents": "None"}, - {"trigger": "not\tkeyword", "contents": "not"}, - {"trigger": "or\tkeyword", "contents": "or"}, - {"trigger": "pass\tkeyword", "contents": "pass"}, - {"trigger": "print\tkeyword", "contents": "print"}, - {"trigger": "raise\tkeyword", "contents": "raise"}, - {"trigger": "return\tkeyword", "contents": "return"}, - {"trigger": "True\tkeyword", "contents": "True"}, - {"trigger": "try\tkeyword", "contents": "try"}, - {"trigger": "while\tkeyword", "contents": "while"}, - {"trigger": "with\tkeyword", "contents": "with"}, - {"trigger": "yield\tkeyword", "contents": "yield"}, - {"trigger": "python\tkeyword", "contents": "python"}, + // IMPORTANT! Completions descriptions are not used due to a bug in Sublime + // Text. Characters not in [a-z-A-Z0-9_-] are avoided in triggers too. + // See https://github.com/SublimeTextIssues/Core/issues/1061 + + // keywords + {"trigger": "and", "contents": "and"}, + {"trigger": "as", "contents": "as"}, + {"trigger": "assert", "contents": "assert"}, + {"trigger": "break", "contents": "break"}, + {"trigger": "continue", "contents": "continue"}, + {"trigger": "del", "contents": "del"}, + {"trigger": "except", "contents": "except"}, + {"trigger": "exec", "contents": "exec"}, + {"trigger": "False", "contents": "False"}, + {"trigger": "finally", "contents": "finally"}, + {"trigger": "for", "contents": "for"}, + {"trigger": "in", "contents": "in"}, + {"trigger": "is", "contents": "is"}, + {"trigger": "None", "contents": "None"}, + {"trigger": "not", "contents": "not"}, + {"trigger": "or", "contents": "or"}, + {"trigger": "pass", "contents": "pass"}, + {"trigger": "print", "contents": "print"}, + {"trigger": "raise", "contents": "raise"}, + {"trigger": "return", "contents": "return"}, + {"trigger": "True", "contents": "True"}, + {"trigger": "try", "contents": "try"}, + {"trigger": "while", "contents": "while"}, + {"trigger": "with", "contents": "with"}, + {"trigger": "yield", "contents": "yield"}, + {"trigger": "python", "contents": "python"}, // Errors and Exceptions - {"trigger": "ArithmeticError\terror", "contents": "ArithmeticError(${1:\"${2: error}\"})"}, - {"trigger": "AssertionError\terror", "contents": "AssertionError(${1:\"${2: error}\"})"}, - {"trigger": "AttributeError\terror", "contents": "AttributeError(${1:\"${2: error}\"})"}, - {"trigger": "BaseException\texception", "contents": "BaseException(${1:\"${2: error}\"})"}, - {"trigger": "BufferError\terror", "contents": "BufferError(${1:\"${2: error}\"})"}, - {"trigger": "BytesWarning\twarning", "contents": "BytesWarning(${1:\"${2: error}\"})"}, - {"trigger": "DeprecationWarning\twarning", "contents": "DeprecationWarning(${1:\"${2: error}\"})"}, - {"trigger": "EnvironmentError\terror", "contents": "EnvironmentError(${1:\"${2: error}\"})"}, - {"trigger": "EOFError\terror", "contents": "EOFError(${1:\"${2: error}\"})"}, - {"trigger": "Exception\texception", "contents": "Exception(${1:\"${2: error}\"})"}, - {"trigger": "FloatingPointError\terror", "contents": "FloatingPointError(${1:\"${2: error}\"})"}, - {"trigger": "FutureWarning\twarning", "contents": "FutureWarning(${1:\"${2: error}\"})"}, - {"trigger": "GeneratorExit\texit", "contents": "GeneratorExit(${1:\"${2: error}\"})"}, - {"trigger": "ImportError\terror", "contents": "ImportError(${1:\"${2: error}\"})"}, - {"trigger": "ImportWarning\twarning", "contents": "ImportWarning(${1:\"${2: error}\"})"}, - {"trigger": "IndentationError\terror", "contents": "IndentationError(${1:\"${2: error}\"})"}, - {"trigger": "IndexError\terror", "contents": "IndexError(${1:\"${2: error}\"})"}, - {"trigger": "IOError\terror", "contents": "IOError(${1:\"${2: error}\"})"}, - {"trigger": "KeyboardInterrupt\t", "contents": "KeyboardInterrupt(${1:\"${2: error}\"})"}, - {"trigger": "KeyError\terror", "contents": "KeyError(${1:\"${2: error}\"})"}, - {"trigger": "LookupError\terror", "contents": "LookupError(${1:\"${2: error}\"})"}, - {"trigger": "MemoryError\terror", "contents": "MemoryError(${1:\"${2: error}\"})"}, - {"trigger": "NameError\terror", "contents": "NameError(${1:\"${2: error}\"})"}, - {"trigger": "NotImplemented\t", "contents": "NotImplemented(${1:\"${2: error}\"})"}, - {"trigger": "NotImplementedError\terror", "contents": "NotImplementedError(${1:\"${2: error}\"})"}, - {"trigger": "OSError\terror", "contents": "OSError(${1:\"${2: error}\"})"}, - {"trigger": "OverflowError\terror", "contents": "OverflowError(${1:\"${2: error}\"})"}, - {"trigger": "PendingDeprecationWarning\twarning", "contents": "PendingDeprecationWarning(${1:\"${2: error}\"})"}, - {"trigger": "ReferenceError\terror", "contents": "ReferenceError(${1:\"${2: error}\"})"}, - {"trigger": "RuntimeError\terror", "contents": "RuntimeError(${1:\"${2: error}\"})"}, - {"trigger": "RuntimeWarning\twarning", "contents": "RuntimeWarning(${1:\"${2: error}\"})"}, - {"trigger": "StandardError\terror", "contents": "StandardError(${1:\"${2: error}\"})"}, - {"trigger": "StopIteration\tstop", "contents": "StopIteration(${1:\"${2: error}\"})"}, - {"trigger": "SyntaxError\terror", "contents": "SyntaxError(${1:\"${2: error}\"})"}, - {"trigger": "SyntaxWarning\twarning", "contents": "SyntaxWarning(${1:\"${2: error}\"})"}, - {"trigger": "SystemError\terror", "contents": "SystemError(${1:\"${2: error}\"})"}, - {"trigger": "SystemExit\texit", "contents": "SystemExit(${1:\"${2: error}\"})"}, - {"trigger": "TabError\terror", "contents": "TabError(${1:\"${2: error}\"})"}, - {"trigger": "TypeError\terror", "contents": "TypeError(${1:\"${2: error}\"})"}, - {"trigger": "UnboundLocalError\terror", "contents": "UnboundLocalError(${1:\"${2: error}\"})"}, - {"trigger": "UnicodeDecodeError\terror", "contents": "UnicodeDecodeError(${1:\"${2: error}\"})"}, - {"trigger": "UnicodeEncodeError\terror", "contents": "UnicodeEncodeError(${1:\"${2: error}\"})"}, - {"trigger": "UnicodeTranslateError\terror", "contents": "UnicodeTranslateError(${1:\"${2: error}\"})"}, - {"trigger": "UnicodeWarning\twarning", "contents": "UnicodeWarning(${1:\"${2: error}\"})"}, - {"trigger": "UserWarning\twarning", "contents": "UserWarning(${1:\"${2: error}\"})"}, - {"trigger": "ValueError\terror", "contents": "ValueError(${1:\"${2: error}\"})"}, - {"trigger": "VMSError\terror", "contents": "VMSError(${1:\"${2: error}\"})"}, - {"trigger": "WindowsError\terror", "contents": "WindowsError(${1:\"${2: error}\"})"}, - {"trigger": "ZeroDivision\terror", "contents": "ZeroDivision(${1:\"${2: error}\"})"}, + {"trigger": "ArithmeticError", "contents": "ArithmeticError(${1:\"${2:error}\"})"}, + {"trigger": "AssertionError", "contents": "AssertionError(${1:\"${2:error}\"})"}, + {"trigger": "AttributeError", "contents": "AttributeError(${1:\"${2:error}\"})"}, + {"trigger": "BaseException", "contents": "BaseException(${1:\"${2:error}\"})"}, + {"trigger": "BufferError", "contents": "BufferError(${1:\"${2:error}\"})"}, + {"trigger": "BytesWarning", "contents": "BytesWarning(${1:\"${2:error}\"})"}, + {"trigger": "DeprecationWarning", "contents": "DeprecationWarning(${1:\"${2:error}\"})"}, + {"trigger": "EnvironmentError", "contents": "EnvironmentError(${1:\"${2:error}\"})"}, + {"trigger": "EOFError", "contents": "EOFError(${1:\"${2:error}\"})"}, + {"trigger": "Exception", "contents": "Exception(${1:\"${2:error}\"})"}, + {"trigger": "FloatingPointError", "contents": "FloatingPointError(${1:\"${2:error}\"})"}, + {"trigger": "FutureWarning", "contents": "FutureWarning(${1:\"${2:error}\"})"}, + {"trigger": "GeneratorExit", "contents": "GeneratorExit(${1:\"${2:error}\"})"}, + {"trigger": "ImportError", "contents": "ImportError(${1:\"${2:error}\"})"}, + {"trigger": "ImportWarning", "contents": "ImportWarning(${1:\"${2:error}\"})"}, + {"trigger": "IndentationError", "contents": "IndentationError(${1:\"${2:error}\"})"}, + {"trigger": "IndexError", "contents": "IndexError(${1:\"${2:error}\"})"}, + {"trigger": "IOError", "contents": "IOError(${1:\"${2:error}\"})"}, + {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt(${1:\"${2:error}\"})"}, + {"trigger": "KeyError", "contents": "KeyError(${1:\"${2:error}\"})"}, + {"trigger": "LookupError", "contents": "LookupError(${1:\"${2:error}\"})"}, + {"trigger": "MemoryError", "contents": "MemoryError(${1:\"${2:error}\"})"}, + {"trigger": "NameError", "contents": "NameError(${1:\"${2:error}\"})"}, + {"trigger": "NotImplemented", "contents": "NotImplemented(${1:\"${2:error}\"})"}, + {"trigger": "NotImplementedError", "contents": "NotImplementedError(${1:\"${2:error}\"})"}, + {"trigger": "OSError", "contents": "OSError(${1:\"${2:error}\"})"}, + {"trigger": "OverflowError", "contents": "OverflowError(${1:\"${2:error}\"})"}, + {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning(${1:\"${2:error}\"})"}, + {"trigger": "ReferenceError", "contents": "ReferenceError(${1:\"${2:error}\"})"}, + {"trigger": "RuntimeError", "contents": "RuntimeError(${1:\"${2:error}\"})"}, + {"trigger": "RuntimeWarning", "contents": "RuntimeWarning(${1:\"${2:error}\"})"}, + {"trigger": "StandardError", "contents": "StandardError(${1:\"${2:error}\"})"}, + {"trigger": "StopIteration", "contents": "StopIteration(${1:\"${2:error}\"})"}, + {"trigger": "SyntaxError", "contents": "SyntaxError(${1:\"${2:error}\"})"}, + {"trigger": "SyntaxWarning", "contents": "SyntaxWarning(${1:\"${2:error}\"})"}, + {"trigger": "SystemError", "contents": "SystemError(${1:\"${2:error}\"})"}, + {"trigger": "SystemExit", "contents": "SystemExit(${1:\"${2:error}\"})"}, + {"trigger": "TabError", "contents": "TabError(${1:\"${2:error}\"})"}, + {"trigger": "TypeError", "contents": "TypeError(${1:\"${2:error}\"})"}, + {"trigger": "UnboundLocalError", "contents": "UnboundLocalError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeWarning", "contents": "UnicodeWarning(${1:\"${2:error}\"})"}, + {"trigger": "UserWarning", "contents": "UserWarning(${1:\"${2:error}\"})"}, + {"trigger": "ValueError", "contents": "ValueError(${1:\"${2:error}\"})"}, + {"trigger": "VMSError", "contents": "VMSError(${1:\"${2:error}\"})"}, + {"trigger": "WindowsError", "contents": "WindowsError(${1:\"${2:error}\"})"}, + {"trigger": "ZeroDivision", "contents": "ZeroDivision(${1:\"${2:error}\"})"}, // built-in functions with constant arg list - {"trigger":"else\telse", "contents": "else:\n\t${1:pass}\n$0"}, - {"trigger":"elif\telif", "contents": "elif ${1:cond}:\n\t${2:pass}\n$0"}, - {"trigger":"abs\tabs(number)", "contents": "abs(${1:x})"}, - {"trigger":"all\tall", "contents": "all(${1:iterable})"}, - {"trigger":"any\tany", "contents": "any(${1:iterable})"}, - {"trigger":"basestring\tbasestring", "contents": "basestring()"}, - {"trigger":"bin\tbin", "contents": "bin(${1:x})"}, - {"trigger":"bool\tbool", "contents": "bool(${1:x})"}, - {"trigger":"callable\tcallable", "contents": "callable(${1:object})"}, - {"trigger":"chr\tchr", "contents": "chr(${1:i})"}, - {"trigger":"classmethod\tclassmethod", "contents": "classmethod(${1:function})"}, - {"trigger":"cmp\tcmp", "contents": "cmp(${1:x}, ${2:y})"}, - {"trigger":"delattr\tdelattr", "contents": "delattr(${1:object}, ${2:name})"}, - {"trigger":"dict\tdict", "contents": "dict(**kwarg)"}, - {"trigger":"dir\tdir", "contents": "dir(${1:object})"}, - {"trigger":"divmod\tdivmod", "contents": "divmod(${1:a}, ${2:b})"}, - {"trigger":"enumerate\tenumerate", "contents": "enumerate(${1:sequence}, start=0)"}, - {"trigger":"filter\tfilter", "contents": "filter(${1:function}, ${2:iterable})"}, - {"trigger":"float\tfloat", "contents": "float(${1:x})"}, - {"trigger":"frozenset\tfrozenset", "contents": "frozenset(${1:iterable})"}, - {"trigger":"globals\tglobals", "contents": "globals()"}, - {"trigger":"hasattr\thasattr", "contents": "hasattr(${1:object}, ${2:name})"}, - {"trigger":"hash\thash", "contents": "hash(${1:object})"}, - {"trigger":"help\thelp", "contents": "help(${1:object})"}, - {"trigger":"hex\thex", "contents": "hex(${1:x})"}, - {"trigger":"id\tid", "contents": "id(${1:object})"}, - {"trigger":"input\tinput", "contents": "input(${1:prompt})"}, - {"trigger":"int\tint", "contents": "int(${1:x=0})"}, - {"trigger":"isinstance\tisinstance", "contents": "isinstance(${1:object}, ${2:classinfo})"}, - {"trigger":"issubclass\tissubclass", "contents": "issubclass(${1:class}, ${2:classinfo})"}, - {"trigger":"len\tlen", "contents": "len(${1:s})"}, - {"trigger":"list\tlist", "contents": "list(${1:iterable})"}, - {"trigger":"locals\tlocals", "contents": "locals()"}, - {"trigger":"long\tlong", "contents": "long(${1:x})"}, - {"trigger":"map\tmap", "contents": "map(${1:function}, ${2:iterable}, ...)"}, - {"trigger":"memoryview\tmemoryview", "contents": "memoryview(${1:obj})"}, - {"trigger":"object\tobject", "contents": "object()"}, - {"trigger":"oct\toct", "contents": "oct(${1:x})"}, - {"trigger":"ord\tord", "contents": "ord(${1:c})"}, - {"trigger":"print\tprint", "contents": "print(*objects, sep=' ', end='\\n', file=sys.stdout)"}, - {"trigger":"range\trange", "contents": "range(${1:stop})"}, - {"trigger":"raw_input\traw_input", "contents": "raw_input(${1:prompt})"}, - {"trigger":"reload\treload", "contents": "reload(${1:module})"}, - {"trigger":"repr\trepr", "contents": "repr(${1:object})"}, - {"trigger":"reversed\treversed", "contents": "reversed(${1:seq})"}, - {"trigger":"set\tset", "contents": "set(${1:iterable})"}, - {"trigger":"setattr\tsetattr", "contents": "setattr(${1:object}, ${2:name}, ${3:value})"}, - {"trigger":"slice\tslice", "contents": "slice(${1:start}${2:, ${3:stop}}${4:, ${5:step}})"}, - {"trigger":"staticmethod\tstaticmethod", "contents": "staticmethod(${1:function})"}, - {"trigger":"str\tstr", "contents": "str(${1:object=''})"}, - {"trigger":"tuple\ttuple", "contents": "tuple(${1:iterable})"}, - {"trigger":"type\ttype", "contents": "type(${1:object})"}, - {"trigger":"unichr\tunichr", "contents": "unichr(${1:i})"}, - {"trigger":"unicode\tunicode", "contents": "unicode(object='')"}, - {"trigger":"vars\tvars", "contents": "vars(${1:object})"}, - {"trigger":"zip\tzip", "contents": "zip(${1:iterable})"}, - {"trigger":"compile\tcompile", "contents": "compile(${1:source}, ${2:filename}, ${3:mode}, ${4:flags, ${5:dont_inherit}})"}, - {"trigger":"xrange\txrange", "contents": "xrange(${1:start}${2:, ${3:stop}}${4:, ${5:step}})"}, + {"trigger":"else", "contents": "else:\n\t${1:pass}\n$0"}, + {"trigger":"elif", "contents": "elif ${1:cond}:\n\t${2:pass}\n$0"}, + {"trigger":"abs", "contents": "abs(${1:x})"}, + {"trigger":"all", "contents": "all(${1:iterable})"}, + {"trigger":"any", "contents": "any(${1:iterable})"}, + {"trigger":"basestring", "contents": "basestring()"}, + {"trigger":"bin", "contents": "bin(${1:x})"}, + {"trigger":"bool", "contents": "bool(${1:x})"}, + {"trigger":"callable", "contents": "callable(${1:object})"}, + {"trigger":"chr", "contents": "chr(${1:i})"}, + {"trigger":"classmethod", "contents": "classmethod(${1:function})"}, + {"trigger":"cmp", "contents": "cmp(${1:x}, ${2:y})"}, + {"trigger":"delattr", "contents": "delattr(${1:object}, ${2:name})"}, + {"trigger":"dict", "contents": "dict(**kwarg)"}, + {"trigger":"dir", "contents": "dir(${1:object})"}, + {"trigger":"divmod", "contents": "divmod(${1:a}, ${2:b})"}, + {"trigger":"enumerate", "contents": "enumerate(${1:sequence}, start=0)"}, + {"trigger":"filter", "contents": "filter(${1:function}, ${2:iterable})"}, + {"trigger":"float", "contents": "float(${1:x})"}, + {"trigger":"frozenset", "contents": "frozenset(${1:iterable})"}, + {"trigger":"globals", "contents": "globals()"}, + {"trigger":"hasattr", "contents": "hasattr(${1:object}, ${2:name})"}, + {"trigger":"hash", "contents": "hash(${1:object})"}, + {"trigger":"help", "contents": "help(${1:object})"}, + {"trigger":"hex", "contents": "hex(${1:x})"}, + {"trigger":"id", "contents": "id(${1:object})"}, + {"trigger":"input", "contents": "input(${1:prompt})"}, + {"trigger":"int", "contents": "int(${1:x=0})"}, + {"trigger":"isinstance", "contents": "isinstance(${1:object}, ${2:classinfo})"}, + {"trigger":"issubclass", "contents": "issubclass(${1:class}, ${2:classinfo})"}, + {"trigger":"len", "contents": "len(${1:s})"}, + {"trigger":"list", "contents": "list(${1:iterable})"}, + {"trigger":"locals", "contents": "locals()"}, + {"trigger":"long", "contents": "long(${1:x})"}, + {"trigger":"map", "contents": "map(${1:function}, ${2:iterable}, ...)"}, + {"trigger":"memoryview", "contents": "memoryview(${1:obj})"}, + {"trigger":"object", "contents": "object()"}, + {"trigger":"oct", "contents": "oct(${1:x})"}, + {"trigger":"ord", "contents": "ord(${1:c})"}, + {"trigger":"print", "contents": "print(*objects, sep=' ', end='\\n', file=sys.stdout)"}, + {"trigger":"range", "contents": "range(${1:stop})"}, + {"trigger":"raw_input", "contents": "raw_input(${1:prompt})"}, + {"trigger":"reload", "contents": "reload(${1:module})"}, + {"trigger":"repr", "contents": "repr(${1:object})"}, + {"trigger":"reversed", "contents": "reversed(${1:seq})"}, + {"trigger":"set", "contents": "set(${1:iterable})"}, + {"trigger":"setattr", "contents": "setattr(${1:object}, ${2:name}, ${3:value})"}, + {"trigger":"slice", "contents": "slice(${1:start}${2:, ${3:stop}}${4:, ${5:step}})"}, + {"trigger":"staticmethod", "contents": "staticmethod(${1:function})"}, + {"trigger":"str", "contents": "str(${1:object=''})"}, + {"trigger":"tuple", "contents": "tuple(${1:iterable})"}, + {"trigger":"type", "contents": "type(${1:object})"}, + {"trigger":"unichr", "contents": "unichr(${1:i})"}, + {"trigger":"unicode", "contents": "unicode(object='')"}, + {"trigger":"vars", "contents": "vars(${1:object})"}, + {"trigger":"zip", "contents": "zip(${1:iterable})"}, + {"trigger":"compile", "contents": "compile(${1:source}, ${2:filename}, ${3:mode}, ${4:flags, ${5:dont_inherit}})"}, + {"trigger":"xrange", "contents": "xrange(${1:start}${2:, ${3:stop}}${4:, ${5:step}})"}, - // Variable length args - {"trigger":"bytearray\tbytearray", "contents": "bytearray(${1:source${2:, ${3:encoding}${4:, ${5:errors}}}})"}, - {"trigger":"complex\tcomplex", "contents": "complex(${1:real}${2:, ${3:imag}})"}, - {"trigger":"eval\teval", "contents": "eval(${1:expression}${2:, ${3:globals}${4:, ${5:locals}}})"}, - {"trigger":"execfile\texecfile", "contents": "execfile(${1:filename}${2:, ${3:globals}${4:, ${5:locals}}})"}, - {"trigger":"file\tfile", "contents": "file(${1:name}${2:, ${3:mode}${4:, ${5:buffering}}})"}, - {"trigger":"format\tformat", "contents": "format(${1:value}${2:, ${3:format_spec}})"}, - {"trigger":"getattr\tgetattr", "contents": "getattr(${1:object}, ${2: name}${3:, ${4:default}})"}, - {"trigger":"iter\titer", "contents": "iter(${1:o}${2:, ${3:sentinel}})"}, - {"trigger":"max\tmax", "contents": "max(${1:iterable}${2:, ${3:key}})"}, - {"trigger":"min\tmin", "contents": "min(${1:iterable}${2:, ${3:key}})"}, - {"trigger":"next\tnext", "contents": "next(${1:iterator}${2:, ${3:default}})"}, - {"trigger":"open\topen", "contents": "open(${1:name}${2:, ${3:mode}${4:, ${5:buffering}}})"}, - {"trigger":"pow\tpow", "contents": "pow(${1:x}, ${2: y${3:, ${4:z}}})"}, - {"trigger":"property\tproperty", "contents": "property(${1:fget}${2:, ${3:fset}${4:, ${5:fdel}${6:, ${7:doc}}}})"}, - {"trigger":"reduce\treduce", "contents": "reduce(${1:function}, ${2:iterable}${3:, ${4:initializer}})"}, - {"trigger":"round\tround", "contents": "round(${1:number}${2:, ${3:ndigits}})"}, - {"trigger":"sorted\tsorted", "contents": "sorted(${1:iterable}${2:, ${3:key}${4:, ${5:reverse}${6:, ${7:cmp}}}})"}, - {"trigger":"sum\tsum", "contents": "sum(${1:iterable}${2:, ${3:start}})"}, - {"trigger":"super\tsuper", "contents": "super(${1:type}${2:, ${3:object-or-type}})"}, - {"trigger":"__import__\t__import__", "contents": "__import__(${1:name}${2:, ${3:globals}${4:, ${5:locals}${6:, ${7:fromlist}${8:, ${9:level}}}}})"}, + // Variable length args + {"trigger":"bytearray", "contents": "bytearray(${1:source${2:, ${3:encoding}${4:, ${5:errors}}}})"}, + {"trigger":"complex", "contents": "complex(${1:real}${2:, ${3:imag}})"}, + {"trigger":"eval", "contents": "eval(${1:expression}${2:, ${3:globals}${4:, ${5:locals}}})"}, + {"trigger":"execfile", "contents": "execfile(${1:filename}${2:, ${3:globals}${4:, ${5:locals}}})"}, + {"trigger":"file", "contents": "file(${1:name}${2:, ${3:mode}${4:, ${5:buffering}}})"}, + {"trigger":"format", "contents": "format(${1:value}${2:, ${3:format_spec}})"}, + {"trigger":"getattr", "contents": "getattr(${1:object}, ${2: name}${3:, ${4:default}})"}, + {"trigger":"iter", "contents": "iter(${1:o}${2:, ${3:sentinel}})"}, + {"trigger":"max", "contents": "max(${1:iterable}${2:, ${3:key}})"}, + {"trigger":"min", "contents": "min(${1:iterable}${2:, ${3:key}})"}, + {"trigger":"next", "contents": "next(${1:iterator}${2:, ${3:default}})"}, + {"trigger":"open", "contents": "open(${1:name}${2:, ${3:mode}${4:, ${5:buffering}}})"}, + {"trigger":"pow", "contents": "pow(${1:x}, ${2: y${3:, ${4:z}}})"}, + {"trigger":"property", "contents": "property(${1:fget}${2:, ${3:fset}${4:, ${5:fdel}${6:, ${7:doc}}}})"}, + {"trigger":"reduce", "contents": "reduce(${1:function}, ${2:iterable}${3:, ${4:initializer}})"}, + {"trigger":"round", "contents": "round(${1:number}${2:, ${3:ndigits}})"}, + {"trigger":"sorted", "contents": "sorted(${1:iterable}${2:, ${3:key}${4:, ${5:reverse}${6:, ${7:cmp}}}})"}, + {"trigger":"sum", "contents": "sum(${1:iterable}${2:, ${3:start}})"}, + {"trigger":"super", "contents": "super(${1:type}${2:, ${3:object-or-type}})"}, + {"trigger":"__import__", "contents": "__import__(${1:name}${2:, ${3:globals}${4:, ${5:locals}${6:, ${7:fromlist}${8:, ${9:level}}}}})"}, // magic methods - {"trigger": "__abs__\tmagic", "contents": "__abs__"}, - {"trigger": "__add__\tmagic", "contents": "__add__"}, - {"trigger": "__and__\tmagic", "contents": "__and__"}, - {"trigger": "__bases__\tmagic", "contents": "__bases__"}, - {"trigger": "__call__\tmagic", "contents": "__call__"}, - {"trigger": "__class__\tmagic", "contents": "__class__"}, - {"trigger": "__cmp__\tmagic", "contents": "__cmp__"}, - {"trigger": "__coerce__\tmagic", "contents": "__coerce__"}, - {"trigger": "__complex__\tmagic", "contents": "__complex__"}, - {"trigger": "__contains__\tmagic", "contents": "__contains__"}, - {"trigger": "__del__\tmagic", "contents": "__del__"}, - {"trigger": "__delattr__\tmagic", "contents": "__delattr__"}, - {"trigger": "__delete__\tmagic", "contents": "__delete__"}, - {"trigger": "__delitem__\tmagic", "contents": "__delitem__"}, - {"trigger": "__delslice__\tmagic", "contents": "__delslice__"}, - {"trigger": "__dict__\tmagic", "contents": "__dict__"}, - {"trigger": "__div__\tmagic", "contents": "__div__"}, - {"trigger": "__divmod__\tmagic", "contents": "__divmod__"}, - {"trigger": "__doc__\tmagic", "contents": "__doc__"}, - {"trigger": "__enter__\tmagic", "contents": "__enter__"}, - {"trigger": "__eq__\tmagic", "contents": "__eq__"}, - {"trigger": "__exit__\tmagic", "contents": "__exit__"}, - {"trigger": "__file__\tmagic", "contents": "__file__"}, - {"trigger": "__float__\tmagic", "contents": "__float__"}, - {"trigger": "__floordiv__\tmagic", "contents": "__floordiv__"}, - {"trigger": "__func__\tmagic", "contents": "__func__"}, - {"trigger": "__future__\tmagic", "contents": "__future__"}, - {"trigger": "__ge__\tmagic", "contents": "__ge__"}, - {"trigger": "__get__\tmagic", "contents": "__get__"}, - {"trigger": "__getattr__\tmagic", "contents": "__getattr__"}, - {"trigger": "__getattribute__\tmagic", "contents": "__getattribute__"}, - {"trigger": "__getitem__\tmagic", "contents": "__getitem__"}, - {"trigger": "__getslice__\tmagic", "contents": "__getslice__"}, - {"trigger": "__gt__\tmagic", "contents": "__gt__"}, - {"trigger": "__hash__\tmagic", "contents": "__hash__"}, - {"trigger": "__hex__\tmagic", "contents": "__hex__"}, - {"trigger": "__iadd__\tmagic", "contents": "__iadd__"}, - {"trigger": "__iand__\tmagic", "contents": "__iand__"}, - {"trigger": "__idiv__\tmagic", "contents": "__idiv__"}, - {"trigger": "__ifloordiv__\tmagic", "contents": "__ifloordiv__"}, - {"trigger": "__ilshift__\tmagic", "contents": "__ilshift__"}, - {"trigger": "__imod__\tmagic", "contents": "__imod__"}, - {"trigger": "__imul__\tmagic", "contents": "__imul__"}, - {"trigger": "__index__\tmagic", "contents": "__index__"}, - {"trigger": "__init__\tmagic", "contents": "__init__"}, - {"trigger": "__instancecheck__\tmagic", "contents": "__instancecheck__"}, - {"trigger": "__int__\tmagic", "contents": "__int__"}, - {"trigger": "__invert__\tmagic", "contents": "__invert__"}, - {"trigger": "__iop__\tmagic", "contents": "__iop__"}, - {"trigger": "__ior__\tmagic", "contents": "__ior__"}, - {"trigger": "__ipow__\tmagic", "contents": "__ipow__"}, - {"trigger": "__irshift__\tmagic", "contents": "__irshift__"}, - {"trigger": "__isub__\tmagic", "contents": "__isub__"}, - {"trigger": "__iter__\tmagic", "contents": "__iter__"}, - {"trigger": "__itruediv__\tmagic", "contents": "__itruediv__"}, - {"trigger": "__ixor__\tmagic", "contents": "__ixor__"}, - {"trigger": "__le__\tmagic", "contents": "__le__"}, - {"trigger": "__len__\tmagic", "contents": "__len__"}, - {"trigger": "__long__\tmagic", "contents": "__long__"}, - {"trigger": "__lshift__\tmagic", "contents": "__lshift__"}, - {"trigger": "__lt__\tmagic", "contents": "__lt__"}, - {"trigger": "__metaclass__\tmagic", "contents": "__metaclass__"}, - {"trigger": "__mod__\tmagic", "contents": "__mod__"}, - {"trigger": "__module__\tmagic", "contents": "__module__"}, - {"trigger": "__mro__\tmagic", "contents": "__mro__"}, - {"trigger": "__mul__\tmagic", "contents": "__mul__"}, - {"trigger": "__name__\tmagic", "contents": "__name__"}, - {"trigger": "__ne__\tmagic", "contents": "__ne__"}, - {"trigger": "__neg__\tmagic", "contents": "__neg__"}, - {"trigger": "__new__\tmagic", "contents": "__new__"}, - {"trigger": "__nonzero__\tmagic", "contents": "__nonzero__"}, - {"trigger": "__oct__\tmagic", "contents": "__oct__"}, - {"trigger": "__op__\tmagic", "contents": "__op__"}, - {"trigger": "__or__\tmagic", "contents": "__or__"}, - {"trigger": "__pos__\tmagic", "contents": "__pos__"}, - {"trigger": "__pow__\tmagic", "contents": "__pow__"}, - {"trigger": "__radd__\tmagic", "contents": "__radd__"}, - {"trigger": "__rand__\tmagic", "contents": "__rand__"}, - {"trigger": "__rcmp__\tmagic", "contents": "__rcmp__"}, - {"trigger": "__rdiv__\tmagic", "contents": "__rdiv__"}, - {"trigger": "__rdivmod__\tmagic", "contents": "__rdivmod__"}, - {"trigger": "__repr__\tmagic", "contents": "__repr__"}, - {"trigger": "__reversed__\tmagic", "contents": "__reversed__"}, - {"trigger": "__rfloordiv__\tmagic", "contents": "__rfloordiv__"}, - {"trigger": "__rlshift__\tmagic", "contents": "__rlshift__"}, - {"trigger": "__rmod__\tmagic", "contents": "__rmod__"}, - {"trigger": "__rmul__\tmagic", "contents": "__rmul__"}, - {"trigger": "__rop__\tmagic", "contents": "__rop__"}, - {"trigger": "__ror__\tmagic", "contents": "__ror__"}, - {"trigger": "__rpow__\tmagic", "contents": "__rpow__"}, - {"trigger": "__rrshift__\tmagic", "contents": "__rrshift__"}, - {"trigger": "__rshift__\tmagic", "contents": "__rshift__"}, - {"trigger": "__rsub__\tmagic", "contents": "__rsub__"}, - {"trigger": "__rtruediv__\tmagic", "contents": "__rtruediv__"}, - {"trigger": "__rxor__\tmagic", "contents": "__rxor__"}, - {"trigger": "__self__\tmagic", "contents": "__self__"}, - {"trigger": "__set__\tmagic", "contents": "__set__"}, - {"trigger": "__setattr__\tmagic", "contents": "__setattr__"}, - {"trigger": "__setitem__\tmagic", "contents": "__setitem__"}, - {"trigger": "__setslice__\tmagic", "contents": "__setslice__"}, - {"trigger": "__slots__\tmagic", "contents": "__slots__"}, - {"trigger": "__str__\tmagic", "contents": "__str__"}, - {"trigger": "__sub__\tmagic", "contents": "__sub__"}, - {"trigger": "__subclasscheck__\tmagic", "contents": "__subclasscheck__"}, - {"trigger": "__truediv__\tmagic", "contents": "__truediv__"}, - {"trigger": "__unicode__\tmagic", "contents": "__unicode__"}, - {"trigger": "__weakref__\tmagic", "contents": "__weakref__"}, - {"trigger": "__xor__\tmagic", "contents": "__xor__"}, + {"trigger": "__abs__", "contents": "__abs__"}, + {"trigger": "__add__", "contents": "__add__"}, + {"trigger": "__and__", "contents": "__and__"}, + {"trigger": "__bases__", "contents": "__bases__"}, + {"trigger": "__call__", "contents": "__call__"}, + {"trigger": "__class__", "contents": "__class__"}, + {"trigger": "__cmp__", "contents": "__cmp__"}, + {"trigger": "__coerce__", "contents": "__coerce__"}, + {"trigger": "__complex__", "contents": "__complex__"}, + {"trigger": "__contains__", "contents": "__contains__"}, + {"trigger": "__del__", "contents": "__del__"}, + {"trigger": "__delattr__", "contents": "__delattr__"}, + {"trigger": "__delete__", "contents": "__delete__"}, + {"trigger": "__delitem__", "contents": "__delitem__"}, + {"trigger": "__delslice__", "contents": "__delslice__"}, + {"trigger": "__dict__", "contents": "__dict__"}, + {"trigger": "__div__", "contents": "__div__"}, + {"trigger": "__divmod__", "contents": "__divmod__"}, + {"trigger": "__doc__", "contents": "__doc__"}, + {"trigger": "__enter__", "contents": "__enter__"}, + {"trigger": "__eq__", "contents": "__eq__"}, + {"trigger": "__exit__", "contents": "__exit__"}, + {"trigger": "__file__", "contents": "__file__"}, + {"trigger": "__float__", "contents": "__float__"}, + {"trigger": "__floordiv__", "contents": "__floordiv__"}, + {"trigger": "__func__", "contents": "__func__"}, + {"trigger": "__future__", "contents": "__future__"}, + {"trigger": "__ge__", "contents": "__ge__"}, + {"trigger": "__get__", "contents": "__get__"}, + {"trigger": "__getattr__", "contents": "__getattr__"}, + {"trigger": "__getattribute__", "contents": "__getattribute__"}, + {"trigger": "__getitem__", "contents": "__getitem__"}, + {"trigger": "__getslice__", "contents": "__getslice__"}, + {"trigger": "__gt__", "contents": "__gt__"}, + {"trigger": "__hash__", "contents": "__hash__"}, + {"trigger": "__hex__", "contents": "__hex__"}, + {"trigger": "__iadd__", "contents": "__iadd__"}, + {"trigger": "__iand__", "contents": "__iand__"}, + {"trigger": "__idiv__", "contents": "__idiv__"}, + {"trigger": "__ifloordiv__", "contents": "__ifloordiv__"}, + {"trigger": "__ilshift__", "contents": "__ilshift__"}, + {"trigger": "__imod__", "contents": "__imod__"}, + {"trigger": "__imul__", "contents": "__imul__"}, + {"trigger": "__index__", "contents": "__index__"}, + {"trigger": "__init__", "contents": "__init__"}, + {"trigger": "__instancecheck__", "contents": "__instancecheck__"}, + {"trigger": "__int__", "contents": "__int__"}, + {"trigger": "__invert__", "contents": "__invert__"}, + {"trigger": "__iop__", "contents": "__iop__"}, + {"trigger": "__ior__", "contents": "__ior__"}, + {"trigger": "__ipow__", "contents": "__ipow__"}, + {"trigger": "__irshift__", "contents": "__irshift__"}, + {"trigger": "__isub__", "contents": "__isub__"}, + {"trigger": "__iter__", "contents": "__iter__"}, + {"trigger": "__itruediv__", "contents": "__itruediv__"}, + {"trigger": "__ixor__", "contents": "__ixor__"}, + {"trigger": "__le__", "contents": "__le__"}, + {"trigger": "__len__", "contents": "__len__"}, + {"trigger": "__long__", "contents": "__long__"}, + {"trigger": "__lshift__", "contents": "__lshift__"}, + {"trigger": "__lt__", "contents": "__lt__"}, + {"trigger": "__metaclass__", "contents": "__metaclass__"}, + {"trigger": "__mod__", "contents": "__mod__"}, + {"trigger": "__module__", "contents": "__module__"}, + {"trigger": "__mro__", "contents": "__mro__"}, + {"trigger": "__mul__", "contents": "__mul__"}, + {"trigger": "__name__", "contents": "__name__"}, + {"trigger": "__ne__", "contents": "__ne__"}, + {"trigger": "__neg__", "contents": "__neg__"}, + {"trigger": "__new__", "contents": "__new__"}, + {"trigger": "__nonzero__", "contents": "__nonzero__"}, + {"trigger": "__oct__", "contents": "__oct__"}, + {"trigger": "__op__", "contents": "__op__"}, + {"trigger": "__or__", "contents": "__or__"}, + {"trigger": "__pos__", "contents": "__pos__"}, + {"trigger": "__pow__", "contents": "__pow__"}, + {"trigger": "__radd__", "contents": "__radd__"}, + {"trigger": "__rand__", "contents": "__rand__"}, + {"trigger": "__rcmp__", "contents": "__rcmp__"}, + {"trigger": "__rdiv__", "contents": "__rdiv__"}, + {"trigger": "__rdivmod__", "contents": "__rdivmod__"}, + {"trigger": "__repr__", "contents": "__repr__"}, + {"trigger": "__reversed__", "contents": "__reversed__"}, + {"trigger": "__rfloordiv__", "contents": "__rfloordiv__"}, + {"trigger": "__rlshift__", "contents": "__rlshift__"}, + {"trigger": "__rmod__", "contents": "__rmod__"}, + {"trigger": "__rmul__", "contents": "__rmul__"}, + {"trigger": "__rop__", "contents": "__rop__"}, + {"trigger": "__ror__", "contents": "__ror__"}, + {"trigger": "__rpow__", "contents": "__rpow__"}, + {"trigger": "__rrshift__", "contents": "__rrshift__"}, + {"trigger": "__rshift__", "contents": "__rshift__"}, + {"trigger": "__rsub__", "contents": "__rsub__"}, + {"trigger": "__rtruediv__", "contents": "__rtruediv__"}, + {"trigger": "__rxor__", "contents": "__rxor__"}, + {"trigger": "__self__", "contents": "__self__"}, + {"trigger": "__set__", "contents": "__set__"}, + {"trigger": "__setattr__", "contents": "__setattr__"}, + {"trigger": "__setitem__", "contents": "__setitem__"}, + {"trigger": "__setslice__", "contents": "__setslice__"}, + {"trigger": "__slots__", "contents": "__slots__"}, + {"trigger": "__str__", "contents": "__str__"}, + {"trigger": "__sub__", "contents": "__sub__"}, + {"trigger": "__subclasscheck__", "contents": "__subclasscheck__"}, + {"trigger": "__truediv__", "contents": "__truediv__"}, + {"trigger": "__unicode__", "contents": "__unicode__"}, + {"trigger": "__weakref__", "contents": "__weakref__"}, + {"trigger": "__xor__", "contents": "__xor__"}, // Standard Library modules (2.7.3 and 3.x) "2to3", "__builtin__", "__future__", "__main__", "_dummy_thread", "_thread", "_winreg", From 652c9fc472f4531d74c76dca82a37af771f12418 Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Fri, 22 Dec 2017 09:07:11 +0000 Subject: [PATCH 2/5] Reduce auto-complete noise --- Python.sublime-completions | 98 +++++++++++++++---------------- instantiables.sublime-completions | 64 ++++++++++++++++++++ 2 files changed, 113 insertions(+), 49 deletions(-) create mode 100644 instantiables.sublime-completions diff --git a/Python.sublime-completions b/Python.sublime-completions index 5665fd5..d7a5111 100644 --- a/Python.sublime-completions +++ b/Python.sublime-completions @@ -37,55 +37,55 @@ {"trigger": "python", "contents": "python"}, // Errors and Exceptions - {"trigger": "ArithmeticError", "contents": "ArithmeticError(${1:\"${2:error}\"})"}, - {"trigger": "AssertionError", "contents": "AssertionError(${1:\"${2:error}\"})"}, - {"trigger": "AttributeError", "contents": "AttributeError(${1:\"${2:error}\"})"}, - {"trigger": "BaseException", "contents": "BaseException(${1:\"${2:error}\"})"}, - {"trigger": "BufferError", "contents": "BufferError(${1:\"${2:error}\"})"}, - {"trigger": "BytesWarning", "contents": "BytesWarning(${1:\"${2:error}\"})"}, - {"trigger": "DeprecationWarning", "contents": "DeprecationWarning(${1:\"${2:error}\"})"}, - {"trigger": "EnvironmentError", "contents": "EnvironmentError(${1:\"${2:error}\"})"}, - {"trigger": "EOFError", "contents": "EOFError(${1:\"${2:error}\"})"}, - {"trigger": "Exception", "contents": "Exception(${1:\"${2:error}\"})"}, - {"trigger": "FloatingPointError", "contents": "FloatingPointError(${1:\"${2:error}\"})"}, - {"trigger": "FutureWarning", "contents": "FutureWarning(${1:\"${2:error}\"})"}, - {"trigger": "GeneratorExit", "contents": "GeneratorExit(${1:\"${2:error}\"})"}, - {"trigger": "ImportError", "contents": "ImportError(${1:\"${2:error}\"})"}, - {"trigger": "ImportWarning", "contents": "ImportWarning(${1:\"${2:error}\"})"}, - {"trigger": "IndentationError", "contents": "IndentationError(${1:\"${2:error}\"})"}, - {"trigger": "IndexError", "contents": "IndexError(${1:\"${2:error}\"})"}, - {"trigger": "IOError", "contents": "IOError(${1:\"${2:error}\"})"}, - {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt(${1:\"${2:error}\"})"}, - {"trigger": "KeyError", "contents": "KeyError(${1:\"${2:error}\"})"}, - {"trigger": "LookupError", "contents": "LookupError(${1:\"${2:error}\"})"}, - {"trigger": "MemoryError", "contents": "MemoryError(${1:\"${2:error}\"})"}, - {"trigger": "NameError", "contents": "NameError(${1:\"${2:error}\"})"}, - {"trigger": "NotImplemented", "contents": "NotImplemented(${1:\"${2:error}\"})"}, - {"trigger": "NotImplementedError", "contents": "NotImplementedError(${1:\"${2:error}\"})"}, - {"trigger": "OSError", "contents": "OSError(${1:\"${2:error}\"})"}, - {"trigger": "OverflowError", "contents": "OverflowError(${1:\"${2:error}\"})"}, - {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning(${1:\"${2:error}\"})"}, - {"trigger": "ReferenceError", "contents": "ReferenceError(${1:\"${2:error}\"})"}, - {"trigger": "RuntimeError", "contents": "RuntimeError(${1:\"${2:error}\"})"}, - {"trigger": "RuntimeWarning", "contents": "RuntimeWarning(${1:\"${2:error}\"})"}, - {"trigger": "StandardError", "contents": "StandardError(${1:\"${2:error}\"})"}, - {"trigger": "StopIteration", "contents": "StopIteration(${1:\"${2:error}\"})"}, - {"trigger": "SyntaxError", "contents": "SyntaxError(${1:\"${2:error}\"})"}, - {"trigger": "SyntaxWarning", "contents": "SyntaxWarning(${1:\"${2:error}\"})"}, - {"trigger": "SystemError", "contents": "SystemError(${1:\"${2:error}\"})"}, - {"trigger": "SystemExit", "contents": "SystemExit(${1:\"${2:error}\"})"}, - {"trigger": "TabError", "contents": "TabError(${1:\"${2:error}\"})"}, - {"trigger": "TypeError", "contents": "TypeError(${1:\"${2:error}\"})"}, - {"trigger": "UnboundLocalError", "contents": "UnboundLocalError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeWarning", "contents": "UnicodeWarning(${1:\"${2:error}\"})"}, - {"trigger": "UserWarning", "contents": "UserWarning(${1:\"${2:error}\"})"}, - {"trigger": "ValueError", "contents": "ValueError(${1:\"${2:error}\"})"}, - {"trigger": "VMSError", "contents": "VMSError(${1:\"${2:error}\"})"}, - {"trigger": "WindowsError", "contents": "WindowsError(${1:\"${2:error}\"})"}, - {"trigger": "ZeroDivision", "contents": "ZeroDivision(${1:\"${2:error}\"})"}, + {"trigger": "ArithmeticError", "contents": "ArithmeticError"}, + {"trigger": "AssertionError", "contents": "AssertionError"}, + {"trigger": "AttributeError", "contents": "AttributeError"}, + {"trigger": "BaseException", "contents": "BaseException"}, + {"trigger": "BufferError", "contents": "BufferError"}, + {"trigger": "BytesWarning", "contents": "BytesWarning"}, + {"trigger": "DeprecationWarning", "contents": "DeprecationWarning"}, + {"trigger": "EnvironmentError", "contents": "EnvironmentError"}, + {"trigger": "EOFError", "contents": "EOFError"}, + {"trigger": "Exception", "contents": "Exception"}, + {"trigger": "FloatingPointError", "contents": "FloatingPointError"}, + {"trigger": "FutureWarning", "contents": "FutureWarning"}, + {"trigger": "GeneratorExit", "contents": "GeneratorExit"}, + {"trigger": "ImportError", "contents": "ImportError"}, + {"trigger": "ImportWarning", "contents": "ImportWarning"}, + {"trigger": "IndentationError", "contents": "IndentationError"}, + {"trigger": "IndexError", "contents": "IndexError"}, + {"trigger": "IOError", "contents": "IOError"}, + {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt"}, + {"trigger": "KeyError", "contents": "KeyError"}, + {"trigger": "LookupError", "contents": "LookupError"}, + {"trigger": "MemoryError", "contents": "MemoryError"}, + {"trigger": "NameError", "contents": "NameError"}, + {"trigger": "NotImplemented", "contents": "NotImplemented"}, + {"trigger": "NotImplementedError", "contents": "NotImplementedError"}, + {"trigger": "OSError", "contents": "OSError"}, + {"trigger": "OverflowError", "contents": "OverflowError"}, + {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning"}, + {"trigger": "ReferenceError", "contents": "ReferenceError"}, + {"trigger": "RuntimeError", "contents": "RuntimeError"}, + {"trigger": "RuntimeWarning", "contents": "RuntimeWarning"}, + {"trigger": "StandardError", "contents": "StandardError"}, + {"trigger": "StopIteration", "contents": "StopIteration"}, + {"trigger": "SyntaxError", "contents": "SyntaxError"}, + {"trigger": "SyntaxWarning", "contents": "SyntaxWarning"}, + {"trigger": "SystemError", "contents": "SystemError"}, + {"trigger": "SystemExit", "contents": "SystemExit"}, + {"trigger": "TabError", "contents": "TabError"}, + {"trigger": "TypeError", "contents": "TypeError"}, + {"trigger": "UnboundLocalError", "contents": "UnboundLocalError"}, + {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError"}, + {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError"}, + {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError"}, + {"trigger": "UnicodeWarning", "contents": "UnicodeWarning"}, + {"trigger": "UserWarning", "contents": "UserWarning"}, + {"trigger": "ValueError", "contents": "ValueError"}, + {"trigger": "VMSError", "contents": "VMSError"}, + {"trigger": "WindowsError", "contents": "WindowsError"}, + {"trigger": "ZeroDivision", "contents": "ZeroDivision"}, // built-in functions with constant arg list {"trigger":"else", "contents": "else:\n\t${1:pass}\n$0"}, diff --git a/instantiables.sublime-completions b/instantiables.sublime-completions new file mode 100644 index 0000000..1ffce28 --- /dev/null +++ b/instantiables.sublime-completions @@ -0,0 +1,64 @@ +{ + "scope": "source.python - meta.statement.except", + + "completions": + [ + + // IMPORTANT! Completions descriptions are not used due to a bug in Sublime + // Text. Characters not in [a-z-A-Z0-9_-] are avoided in triggers too. + // See https://github.com/SublimeTextIssues/Core/issues/1061 + + + // Errors and Exceptions + {"trigger": "ArithmeticError", "contents": "ArithmeticError(${1:\"${2:error}\"})"}, + {"trigger": "AssertionError", "contents": "AssertionError(${1:\"${2:error}\"})"}, + {"trigger": "AttributeError", "contents": "AttributeError(${1:\"${2:error}\"})"}, + {"trigger": "BaseException", "contents": "BaseException(${1:\"${2:error}\"})"}, + {"trigger": "BufferError", "contents": "BufferError(${1:\"${2:error}\"})"}, + {"trigger": "BytesWarning", "contents": "BytesWarning(${1:\"${2:error}\"})"}, + {"trigger": "DeprecationWarning", "contents": "DeprecationWarning(${1:\"${2:error}\"})"}, + {"trigger": "EnvironmentError", "contents": "EnvironmentError(${1:\"${2:error}\"})"}, + {"trigger": "EOFError", "contents": "EOFError(${1:\"${2:error}\"})"}, + {"trigger": "Exception", "contents": "Exception(${1:\"${2:error}\"})"}, + {"trigger": "FloatingPointError", "contents": "FloatingPointError(${1:\"${2:error}\"})"}, + {"trigger": "FutureWarning", "contents": "FutureWarning(${1:\"${2:error}\"})"}, + {"trigger": "GeneratorExit", "contents": "GeneratorExit(${1:\"${2:error}\"})"}, + {"trigger": "ImportError", "contents": "ImportError(${1:\"${2:error}\"})"}, + {"trigger": "ImportWarning", "contents": "ImportWarning(${1:\"${2:error}\"})"}, + {"trigger": "IndentationError", "contents": "IndentationError(${1:\"${2:error}\"})"}, + {"trigger": "IndexError", "contents": "IndexError(${1:\"${2:error}\"})"}, + {"trigger": "IOError", "contents": "IOError(${1:\"${2:error}\"})"}, + {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt(${1:\"${2:error}\"})"}, + {"trigger": "KeyError", "contents": "KeyError(${1:\"${2:error}\"})"}, + {"trigger": "LookupError", "contents": "LookupError(${1:\"${2:error}\"})"}, + {"trigger": "MemoryError", "contents": "MemoryError(${1:\"${2:error}\"})"}, + {"trigger": "NameError", "contents": "NameError(${1:\"${2:error}\"})"}, + {"trigger": "NotImplemented", "contents": "NotImplemented(${1:\"${2:error}\"})"}, + {"trigger": "NotImplementedError", "contents": "NotImplementedError(${1:\"${2:error}\"})"}, + {"trigger": "OSError", "contents": "OSError(${1:\"${2:error}\"})"}, + {"trigger": "OverflowError", "contents": "OverflowError(${1:\"${2:error}\"})"}, + {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning(${1:\"${2:error}\"})"}, + {"trigger": "ReferenceError", "contents": "ReferenceError(${1:\"${2:error}\"})"}, + {"trigger": "RuntimeError", "contents": "RuntimeError(${1:\"${2:error}\"})"}, + {"trigger": "RuntimeWarning", "contents": "RuntimeWarning(${1:\"${2:error}\"})"}, + {"trigger": "StandardError", "contents": "StandardError(${1:\"${2:error}\"})"}, + {"trigger": "StopIteration", "contents": "StopIteration(${1:\"${2:error}\"})"}, + {"trigger": "SyntaxError", "contents": "SyntaxError(${1:\"${2:error}\"})"}, + {"trigger": "SyntaxWarning", "contents": "SyntaxWarning(${1:\"${2:error}\"})"}, + {"trigger": "SystemError", "contents": "SystemError(${1:\"${2:error}\"})"}, + {"trigger": "SystemExit", "contents": "SystemExit(${1:\"${2:error}\"})"}, + {"trigger": "TabError", "contents": "TabError(${1:\"${2:error}\"})"}, + {"trigger": "TypeError", "contents": "TypeError(${1:\"${2:error}\"})"}, + {"trigger": "UnboundLocalError", "contents": "UnboundLocalError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError(${1:\"${2:error}\"})"}, + {"trigger": "UnicodeWarning", "contents": "UnicodeWarning(${1:\"${2:error}\"})"}, + {"trigger": "UserWarning", "contents": "UserWarning(${1:\"${2:error}\"})"}, + {"trigger": "ValueError", "contents": "ValueError(${1:\"${2:error}\"})"}, + {"trigger": "VMSError", "contents": "VMSError(${1:\"${2:error}\"})"}, + {"trigger": "WindowsError", "contents": "WindowsError(${1:\"${2:error}\"})"}, + {"trigger": "ZeroDivision", "contents": "ZeroDivision(${1:\"${2:error}\"})"}, + + ] +} From e3db94e7fa23dd9287f169b357a890c7cb478e28 Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Wed, 10 Jan 2018 10:46:35 +0000 Subject: [PATCH 3/5] Fixes and enhancements --- Python.sublime-completions | 56 +---------------- assertions.sublime-completions | 47 ++++++++++++++ instantiables.sublime-completions | 100 +++++++++++++++--------------- type_class.sublime-completions | 61 ++++++++++++++++++ 4 files changed, 160 insertions(+), 104 deletions(-) create mode 100644 assertions.sublime-completions create mode 100644 type_class.sublime-completions diff --git a/Python.sublime-completions b/Python.sublime-completions index d7a5111..4b75dc8 100644 --- a/Python.sublime-completions +++ b/Python.sublime-completions @@ -1,5 +1,5 @@ { - "scope": "source.python", + "scope": "source.python - meta.class.inheritance", "completions": [ @@ -36,57 +36,6 @@ {"trigger": "yield", "contents": "yield"}, {"trigger": "python", "contents": "python"}, - // Errors and Exceptions - {"trigger": "ArithmeticError", "contents": "ArithmeticError"}, - {"trigger": "AssertionError", "contents": "AssertionError"}, - {"trigger": "AttributeError", "contents": "AttributeError"}, - {"trigger": "BaseException", "contents": "BaseException"}, - {"trigger": "BufferError", "contents": "BufferError"}, - {"trigger": "BytesWarning", "contents": "BytesWarning"}, - {"trigger": "DeprecationWarning", "contents": "DeprecationWarning"}, - {"trigger": "EnvironmentError", "contents": "EnvironmentError"}, - {"trigger": "EOFError", "contents": "EOFError"}, - {"trigger": "Exception", "contents": "Exception"}, - {"trigger": "FloatingPointError", "contents": "FloatingPointError"}, - {"trigger": "FutureWarning", "contents": "FutureWarning"}, - {"trigger": "GeneratorExit", "contents": "GeneratorExit"}, - {"trigger": "ImportError", "contents": "ImportError"}, - {"trigger": "ImportWarning", "contents": "ImportWarning"}, - {"trigger": "IndentationError", "contents": "IndentationError"}, - {"trigger": "IndexError", "contents": "IndexError"}, - {"trigger": "IOError", "contents": "IOError"}, - {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt"}, - {"trigger": "KeyError", "contents": "KeyError"}, - {"trigger": "LookupError", "contents": "LookupError"}, - {"trigger": "MemoryError", "contents": "MemoryError"}, - {"trigger": "NameError", "contents": "NameError"}, - {"trigger": "NotImplemented", "contents": "NotImplemented"}, - {"trigger": "NotImplementedError", "contents": "NotImplementedError"}, - {"trigger": "OSError", "contents": "OSError"}, - {"trigger": "OverflowError", "contents": "OverflowError"}, - {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning"}, - {"trigger": "ReferenceError", "contents": "ReferenceError"}, - {"trigger": "RuntimeError", "contents": "RuntimeError"}, - {"trigger": "RuntimeWarning", "contents": "RuntimeWarning"}, - {"trigger": "StandardError", "contents": "StandardError"}, - {"trigger": "StopIteration", "contents": "StopIteration"}, - {"trigger": "SyntaxError", "contents": "SyntaxError"}, - {"trigger": "SyntaxWarning", "contents": "SyntaxWarning"}, - {"trigger": "SystemError", "contents": "SystemError"}, - {"trigger": "SystemExit", "contents": "SystemExit"}, - {"trigger": "TabError", "contents": "TabError"}, - {"trigger": "TypeError", "contents": "TypeError"}, - {"trigger": "UnboundLocalError", "contents": "UnboundLocalError"}, - {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError"}, - {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError"}, - {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError"}, - {"trigger": "UnicodeWarning", "contents": "UnicodeWarning"}, - {"trigger": "UserWarning", "contents": "UserWarning"}, - {"trigger": "ValueError", "contents": "ValueError"}, - {"trigger": "VMSError", "contents": "VMSError"}, - {"trigger": "WindowsError", "contents": "WindowsError"}, - {"trigger": "ZeroDivision", "contents": "ZeroDivision"}, - // built-in functions with constant arg list {"trigger":"else", "contents": "else:\n\t${1:pass}\n$0"}, {"trigger":"elif", "contents": "elif ${1:cond}:\n\t${2:pass}\n$0"}, @@ -104,7 +53,7 @@ {"trigger":"dict", "contents": "dict(**kwarg)"}, {"trigger":"dir", "contents": "dir(${1:object})"}, {"trigger":"divmod", "contents": "divmod(${1:a}, ${2:b})"}, - {"trigger":"enumerate", "contents": "enumerate(${1:sequence}, start=0)"}, + {"trigger":"enumerate", "contents": "enumerate(${1:sequence}, start=${2:0})"}, {"trigger":"filter", "contents": "filter(${1:function}, ${2:iterable})"}, {"trigger":"float", "contents": "float(${1:x})"}, {"trigger":"frozenset", "contents": "frozenset(${1:iterable})"}, @@ -315,5 +264,6 @@ "unicodedata", "unittest", "urllib", "urllib2", "urlparse", "user", "UserDict", "UserList", "UserString", "uu", "uuid", "venv", "warnings", "wave", "weakref", "webbrowser", "whichdb", "winreg", "winsound", "wsgiref", "xdrlib", "xmlreader", "xmlrpc", "xmlrpclib", "zipfile", "zipimport", "zlib" + ] } diff --git a/assertions.sublime-completions b/assertions.sublime-completions new file mode 100644 index 0000000..6c5b93c --- /dev/null +++ b/assertions.sublime-completions @@ -0,0 +1,47 @@ +{ + "scope": "source.python - meta.class.inheritance", + + "completions": + [ + + // IMPORTANT! Completions descriptions are not used due to a bug in Sublime + // Text. Characters not in [a-z-A-Z0-9_-] are avoided in triggers too. + // See https://github.com/SublimeTextIssues/Core/issues/1061 + + {"trigger": "assertFalse", "contents": "self.assertFalse(${1:expr}, '${2}')" }, + {"trigger": "assertTrue", "contents": "self.assertTrue(${1:expr}, ${2:msg=None})" }, + {"trigger": "assertRaises", "contents": "self.assertRaises(${1:exception}, msg='${2}')" }, + {"trigger": "assertWarns", "contents": "self.assertWarns(${1:expected_warning}, *args, **kwargs)" }, + {"trigger": "assertLogs", "contents": "self.assertLogs(logger=None, level=None)" }, + {"trigger": "assertEqual", "contents": "self.assertEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertEqual", "contents": "self.assertEqual(${1:actual}, ${2:expected}${3:, msg='${4}'})" }, + {"trigger": "assertNotEqual", "contents": "self.assertNotEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertAlmostEqual", "contents": "self.assertAlmostEqual(${1:first}, ${2:expected}, places=None, msg=None" }, + {"trigger": "assertNotAlmostEqual", "contents": "self.assertNotAlmostEqual(${1:first}, ${2:expected}, places=None, msg=None" }, + {"trigger": "assertSequenceEqual", "contents": "self.assertSequenceEqual(seq1, seq2, msg=None, seq_type=None)" }, + {"trigger": "assertListEqual", "contents": "self.assertListEqual(list1, list2, msg=None)" }, + {"trigger": "assertTupleEqual", "contents": "self.assertTupleEqual(tuple1, tuple2, msg=None)" }, + {"trigger": "assertSetEqual", "contents": "self.assertSetEqual(set1, set2, msg=None)" }, + {"trigger": "assertIn", "contents": "self.assertIn(member, container, msg=None)" }, + {"trigger": "assertNotIn", "contents": "self.assertNotIn(member, container, msg=None)" }, + {"trigger": "assertIs", "contents": "self.assertIs(${1:expr1}, ${2:expr2}, ${3:msg=None})" }, + {"trigger": "assertIsNot", "contents": "self.assertIsNot(${1:expr1}, ${2:expr2}, ${3:msg=None})" }, + {"trigger": "assertDictEqual", "contents": "self.assertDictEqual(d1, d2, msg=None)" }, + {"trigger": "assertDictContainsSubset", "contents": "self.assertDictContainsSubset(subset, dictionary, msg=None)" }, + {"trigger": "assertCountEqual", "contents": "self.assertCountEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertMultiLineEqual", "contents": "self.assertMultiLineEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertLess", "contents": "self.assertLess(${1:a}, ${2:b}, ${3:msg=None})" }, + {"trigger": "assertLessEqual", "contents": "self.assertLessEqual(${1:a}, ${2:b}, ${3:msg=None})" }, + {"trigger": "assertGreater", "contents": "self.assertGreater(${1:a}, ${2:b}, ${3:msg=None})" }, + {"trigger": "assertGreaterEqual", "contents": "self.assertGreaterEqual(${1:a}, ${2:b}, ${3:msg=None})" }, + {"trigger": "assertIsNone", "contents": "self.assertIsNone(obj, msg=None)" }, + {"trigger": "assertIsNotNone", "contents": "self.assertIsNotNone(obj, msg=None)" }, + {"trigger": "assertIsInstance", "contents": "self.assertIsInstance(obj, cls, msg=None)" }, + {"trigger": "assertNotIsInstance", "contents": "self.assertNotIsInstance(obj, cls, msg=None)" }, + {"trigger": "assertRaisesRegex", "contents": "self.assertRaisesRegex(${1:exception}, ${2:expected_regex}" }, + {"trigger": "assertWarnsRegex", "contents": "self.assertWarnsRegex(${1:expected_warning}, ${2:expected_regex}" }, + {"trigger": "assertRegex", "contents": "self.assertRegex(text, expected_regex, msg=None)" }, + {"trigger": "assertNotRegex", "contents": "self.assertNotRegex(text, unexpected_regex, msg=None)" }, + + ] +} diff --git a/instantiables.sublime-completions b/instantiables.sublime-completions index 1ffce28..6fcb627 100644 --- a/instantiables.sublime-completions +++ b/instantiables.sublime-completions @@ -1,5 +1,5 @@ { - "scope": "source.python - meta.statement.except", + "scope": "source.python - meta.statement.except - meta.statement.with", "completions": [ @@ -8,57 +8,55 @@ // Text. Characters not in [a-z-A-Z0-9_-] are avoided in triggers too. // See https://github.com/SublimeTextIssues/Core/issues/1061 - // Errors and Exceptions - {"trigger": "ArithmeticError", "contents": "ArithmeticError(${1:\"${2:error}\"})"}, - {"trigger": "AssertionError", "contents": "AssertionError(${1:\"${2:error}\"})"}, - {"trigger": "AttributeError", "contents": "AttributeError(${1:\"${2:error}\"})"}, - {"trigger": "BaseException", "contents": "BaseException(${1:\"${2:error}\"})"}, - {"trigger": "BufferError", "contents": "BufferError(${1:\"${2:error}\"})"}, - {"trigger": "BytesWarning", "contents": "BytesWarning(${1:\"${2:error}\"})"}, - {"trigger": "DeprecationWarning", "contents": "DeprecationWarning(${1:\"${2:error}\"})"}, - {"trigger": "EnvironmentError", "contents": "EnvironmentError(${1:\"${2:error}\"})"}, - {"trigger": "EOFError", "contents": "EOFError(${1:\"${2:error}\"})"}, - {"trigger": "Exception", "contents": "Exception(${1:\"${2:error}\"})"}, - {"trigger": "FloatingPointError", "contents": "FloatingPointError(${1:\"${2:error}\"})"}, - {"trigger": "FutureWarning", "contents": "FutureWarning(${1:\"${2:error}\"})"}, - {"trigger": "GeneratorExit", "contents": "GeneratorExit(${1:\"${2:error}\"})"}, - {"trigger": "ImportError", "contents": "ImportError(${1:\"${2:error}\"})"}, - {"trigger": "ImportWarning", "contents": "ImportWarning(${1:\"${2:error}\"})"}, - {"trigger": "IndentationError", "contents": "IndentationError(${1:\"${2:error}\"})"}, - {"trigger": "IndexError", "contents": "IndexError(${1:\"${2:error}\"})"}, - {"trigger": "IOError", "contents": "IOError(${1:\"${2:error}\"})"}, - {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt(${1:\"${2:error}\"})"}, - {"trigger": "KeyError", "contents": "KeyError(${1:\"${2:error}\"})"}, - {"trigger": "LookupError", "contents": "LookupError(${1:\"${2:error}\"})"}, - {"trigger": "MemoryError", "contents": "MemoryError(${1:\"${2:error}\"})"}, - {"trigger": "NameError", "contents": "NameError(${1:\"${2:error}\"})"}, - {"trigger": "NotImplemented", "contents": "NotImplemented(${1:\"${2:error}\"})"}, - {"trigger": "NotImplementedError", "contents": "NotImplementedError(${1:\"${2:error}\"})"}, - {"trigger": "OSError", "contents": "OSError(${1:\"${2:error}\"})"}, - {"trigger": "OverflowError", "contents": "OverflowError(${1:\"${2:error}\"})"}, - {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning(${1:\"${2:error}\"})"}, - {"trigger": "ReferenceError", "contents": "ReferenceError(${1:\"${2:error}\"})"}, - {"trigger": "RuntimeError", "contents": "RuntimeError(${1:\"${2:error}\"})"}, - {"trigger": "RuntimeWarning", "contents": "RuntimeWarning(${1:\"${2:error}\"})"}, - {"trigger": "StandardError", "contents": "StandardError(${1:\"${2:error}\"})"}, - {"trigger": "StopIteration", "contents": "StopIteration(${1:\"${2:error}\"})"}, - {"trigger": "SyntaxError", "contents": "SyntaxError(${1:\"${2:error}\"})"}, - {"trigger": "SyntaxWarning", "contents": "SyntaxWarning(${1:\"${2:error}\"})"}, - {"trigger": "SystemError", "contents": "SystemError(${1:\"${2:error}\"})"}, - {"trigger": "SystemExit", "contents": "SystemExit(${1:\"${2:error}\"})"}, - {"trigger": "TabError", "contents": "TabError(${1:\"${2:error}\"})"}, - {"trigger": "TypeError", "contents": "TypeError(${1:\"${2:error}\"})"}, - {"trigger": "UnboundLocalError", "contents": "UnboundLocalError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError(${1:\"${2:error}\"})"}, - {"trigger": "UnicodeWarning", "contents": "UnicodeWarning(${1:\"${2:error}\"})"}, - {"trigger": "UserWarning", "contents": "UserWarning(${1:\"${2:error}\"})"}, - {"trigger": "ValueError", "contents": "ValueError(${1:\"${2:error}\"})"}, - {"trigger": "VMSError", "contents": "VMSError(${1:\"${2:error}\"})"}, - {"trigger": "WindowsError", "contents": "WindowsError(${1:\"${2:error}\"})"}, - {"trigger": "ZeroDivision", "contents": "ZeroDivision(${1:\"${2:error}\"})"}, + {"trigger": "ArithmeticError", "contents": "ArithmeticError(${1:'${2:error}'})"}, + {"trigger": "AssertionError", "contents": "AssertionError(${1:'${2:error}'})"}, + {"trigger": "AttributeError", "contents": "AttributeError(${1:'${2:error}'})"}, + {"trigger": "BaseException", "contents": "BaseException(${1:'${2:error}'})"}, + {"trigger": "BufferError", "contents": "BufferError(${1:'${2:error}'})"}, + {"trigger": "BytesWarning", "contents": "BytesWarning(${1:'${2:error}'})"}, + {"trigger": "DeprecationWarning", "contents": "DeprecationWarning(${1:'${2:error}'})"}, + {"trigger": "EnvironmentError", "contents": "EnvironmentError(${1:'${2:error}'})"}, + {"trigger": "EOFError", "contents": "EOFError(${1:'${2:error}'})"}, + {"trigger": "Exception", "contents": "Exception(${1:'${2:error}'})"}, + {"trigger": "FloatingPointError", "contents": "FloatingPointError(${1:'${2:error}'})"}, + {"trigger": "FutureWarning", "contents": "FutureWarning(${1:'${2:error}'})"}, + {"trigger": "GeneratorExit", "contents": "GeneratorExit(${1:'${2:error}'})"}, + {"trigger": "ImportError", "contents": "ImportError(${1:'${2:error}'})"}, + {"trigger": "ImportWarning", "contents": "ImportWarning(${1:'${2:error}'})"}, + {"trigger": "IndentationError", "contents": "IndentationError(${1:'${2:error}'})"}, + {"trigger": "IndexError", "contents": "IndexError(${1:'${2:error}'})"}, + {"trigger": "IOError", "contents": "IOError(${1:'${2:error}'})"}, + {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt(${1:'${2:error}'})"}, + {"trigger": "KeyError", "contents": "KeyError(${1:'${2:error}'})"}, + {"trigger": "LookupError", "contents": "LookupError(${1:'${2:error}'})"}, + {"trigger": "MemoryError", "contents": "MemoryError(${1:'${2:error}'})"}, + {"trigger": "NameError", "contents": "NameError(${1:'${2:error}'})"}, + {"trigger": "NotImplementedError", "contents": "NotImplementedError(${1:'${2:error}'})"}, + {"trigger": "OSError", "contents": "OSError(${1:'${2:error}'})"}, + {"trigger": "OverflowError", "contents": "OverflowError(${1:'${2:error}'})"}, + {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning(${1:'${2:error}'})"}, + {"trigger": "ReferenceError", "contents": "ReferenceError(${1:'${2:error}'})"}, + {"trigger": "RuntimeError", "contents": "RuntimeError(${1:'${2:error}'})"}, + {"trigger": "RuntimeWarning", "contents": "RuntimeWarning(${1:'${2:error}'})"}, + {"trigger": "StandardError", "contents": "StandardError(${1:'${2:error}'})"}, + {"trigger": "StopIteration", "contents": "StopIteration(${1:'${2:error}'})"}, + {"trigger": "SyntaxError", "contents": "SyntaxError(${1:'${2:error}'})"}, + {"trigger": "SyntaxWarning", "contents": "SyntaxWarning(${1:'${2:error}'})"}, + {"trigger": "SystemError", "contents": "SystemError(${1:'${2:error}'})"}, + {"trigger": "SystemExit", "contents": "SystemExit(${1:'${2:error}'})"}, + {"trigger": "TabError", "contents": "TabError(${1:'${2:error}'})"}, + {"trigger": "TypeError", "contents": "TypeError(${1:'${2:error}'})"}, + {"trigger": "UnboundLocalError", "contents": "UnboundLocalError(${1:'${2:error}'})"}, + {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError(${1:'${2:error}'})"}, + {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError(${1:'${2:error}'})"}, + {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError(${1:'${2:error}'})"}, + {"trigger": "UnicodeWarning", "contents": "UnicodeWarning(${1:'${2:error}'})"}, + {"trigger": "UserWarning", "contents": "UserWarning(${1:'${2:error}'})"}, + {"trigger": "ValueError", "contents": "ValueError(${1:'${2:error}'})"}, + {"trigger": "VMSError", "contents": "VMSError(${1:'${2:error}'})"}, + {"trigger": "WindowsError", "contents": "WindowsError(${1:'${2:error}'})"}, + {"trigger": "ZeroDivision", "contents": "ZeroDivision(${1:'${2:error}'})"}, ] } diff --git a/type_class.sublime-completions b/type_class.sublime-completions new file mode 100644 index 0000000..9494bca --- /dev/null +++ b/type_class.sublime-completions @@ -0,0 +1,61 @@ +{ + "scope": "source.python - meta.statement.raise", + "completions": + [ + + // IMPORTANT! Completions descriptions are not used due to a bug in Sublime + // Text. Characters not in [a-z-A-Z0-9_-] are avoided in triggers too. + // See https://github.com/SublimeTextIssues/Core/issues/1061 + + // Errors and Exceptions + {"trigger": "ArithmeticError", "contents": "ArithmeticError"}, + {"trigger": "AssertionError", "contents": "AssertionError"}, + {"trigger": "AttributeError", "contents": "AttributeError"}, + {"trigger": "BaseException", "contents": "BaseException"}, + {"trigger": "BufferError", "contents": "BufferError"}, + {"trigger": "BytesWarning", "contents": "BytesWarning"}, + {"trigger": "DeprecationWarning", "contents": "DeprecationWarning"}, + {"trigger": "EnvironmentError", "contents": "EnvironmentError"}, + {"trigger": "EOFError", "contents": "EOFError"}, + {"trigger": "Exception", "contents": "Exception"}, + {"trigger": "FloatingPointError", "contents": "FloatingPointError"}, + {"trigger": "FutureWarning", "contents": "FutureWarning"}, + {"trigger": "GeneratorExit", "contents": "GeneratorExit"}, + {"trigger": "ImportError", "contents": "ImportError"}, + {"trigger": "ImportWarning", "contents": "ImportWarning"}, + {"trigger": "IndentationError", "contents": "IndentationError"}, + {"trigger": "IndexError", "contents": "IndexError"}, + {"trigger": "IOError", "contents": "IOError"}, + {"trigger": "KeyboardInterrupt", "contents": "KeyboardInterrupt"}, + {"trigger": "KeyError", "contents": "KeyError"}, + {"trigger": "LookupError", "contents": "LookupError"}, + {"trigger": "MemoryError", "contents": "MemoryError"}, + {"trigger": "NameError", "contents": "NameError"}, + {"trigger": "NotImplementedError", "contents": "NotImplementedError"}, + {"trigger": "OSError", "contents": "OSError"}, + {"trigger": "OverflowError", "contents": "OverflowError"}, + {"trigger": "PendingDeprecationWarning", "contents": "PendingDeprecationWarning"}, + {"trigger": "ReferenceError", "contents": "ReferenceError"}, + {"trigger": "RuntimeError", "contents": "RuntimeError"}, + {"trigger": "RuntimeWarning", "contents": "RuntimeWarning"}, + {"trigger": "StandardError", "contents": "StandardError"}, + {"trigger": "StopIteration", "contents": "StopIteration"}, + {"trigger": "SyntaxError", "contents": "SyntaxError"}, + {"trigger": "SyntaxWarning", "contents": "SyntaxWarning"}, + {"trigger": "SystemError", "contents": "SystemError"}, + {"trigger": "SystemExit", "contents": "SystemExit"}, + {"trigger": "TabError", "contents": "TabError"}, + {"trigger": "TypeError", "contents": "TypeError"}, + {"trigger": "UnboundLocalError", "contents": "UnboundLocalError"}, + {"trigger": "UnicodeDecodeError", "contents": "UnicodeDecodeError"}, + {"trigger": "UnicodeEncodeError", "contents": "UnicodeEncodeError"}, + {"trigger": "UnicodeTranslateError", "contents": "UnicodeTranslateError"}, + {"trigger": "UnicodeWarning", "contents": "UnicodeWarning"}, + {"trigger": "UserWarning", "contents": "UserWarning"}, + {"trigger": "ValueError", "contents": "ValueError"}, + {"trigger": "VMSError", "contents": "VMSError"}, + {"trigger": "WindowsError", "contents": "WindowsError"}, + {"trigger": "ZeroDivision", "contents": "ZeroDivision"}, + + ] +} From 8eedc875dfd5f683a6e0eb683e2e74ffc2b38fee Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Wed, 10 Jan 2018 15:17:31 +0000 Subject: [PATCH 4/5] Fixes and enhancements --- assertions.sublime-completions | 53 +++++++++++++++---------------- instantiables.sublime-completions | 2 +- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/assertions.sublime-completions b/assertions.sublime-completions index 6c5b93c..34a8002 100644 --- a/assertions.sublime-completions +++ b/assertions.sublime-completions @@ -1,5 +1,5 @@ { - "scope": "source.python - meta.class.inheritance", + "scope": "source.python - meta.class.inheritance - comment - variable - string", "completions": [ @@ -8,40 +8,39 @@ // Text. Characters not in [a-z-A-Z0-9_-] are avoided in triggers too. // See https://github.com/SublimeTextIssues/Core/issues/1061 - {"trigger": "assertFalse", "contents": "self.assertFalse(${1:expr}, '${2}')" }, - {"trigger": "assertTrue", "contents": "self.assertTrue(${1:expr}, ${2:msg=None})" }, - {"trigger": "assertRaises", "contents": "self.assertRaises(${1:exception}, msg='${2}')" }, - {"trigger": "assertWarns", "contents": "self.assertWarns(${1:expected_warning}, *args, **kwargs)" }, - {"trigger": "assertLogs", "contents": "self.assertLogs(logger=None, level=None)" }, - {"trigger": "assertEqual", "contents": "self.assertEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, - {"trigger": "assertEqual", "contents": "self.assertEqual(${1:actual}, ${2:expected}${3:, msg='${4}'})" }, - {"trigger": "assertNotEqual", "contents": "self.assertNotEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, {"trigger": "assertAlmostEqual", "contents": "self.assertAlmostEqual(${1:first}, ${2:expected}, places=None, msg=None" }, - {"trigger": "assertNotAlmostEqual", "contents": "self.assertNotAlmostEqual(${1:first}, ${2:expected}, places=None, msg=None" }, - {"trigger": "assertSequenceEqual", "contents": "self.assertSequenceEqual(seq1, seq2, msg=None, seq_type=None)" }, - {"trigger": "assertListEqual", "contents": "self.assertListEqual(list1, list2, msg=None)" }, - {"trigger": "assertTupleEqual", "contents": "self.assertTupleEqual(tuple1, tuple2, msg=None)" }, - {"trigger": "assertSetEqual", "contents": "self.assertSetEqual(set1, set2, msg=None)" }, + {"trigger": "assertCountEqual", "contents": "self.assertCountEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertDictContainsSubset", "contents": "self.assertDictContainsSubset(subset, dictionary, msg=None)" }, + {"trigger": "assertDictEqual", "contents": "self.assertDictEqual(d1, d2, msg=None)" }, + {"trigger": "assertEqual", "contents": "self.assertEqual(${1:actual}, ${2:expected}${3:, msg='${4}'})" }, + {"trigger": "assertFalse", "contents": "self.assertFalse(${1:expr}, '${2}')" }, + {"trigger": "assertGreater", "contents": "self.assertGreater(${1:a}, ${2:b}, ${3:msg=None})" }, + {"trigger": "assertGreaterEqual", "contents": "self.assertGreaterEqual(${1:a}, ${2:b}, ${3:msg=None})" }, {"trigger": "assertIn", "contents": "self.assertIn(member, container, msg=None)" }, - {"trigger": "assertNotIn", "contents": "self.assertNotIn(member, container, msg=None)" }, {"trigger": "assertIs", "contents": "self.assertIs(${1:expr1}, ${2:expr2}, ${3:msg=None})" }, + {"trigger": "assertIsInstance", "contents": "self.assertIsInstance(${1:obj}, ${2:cls}${3:, msg='${4}'})" }, + {"trigger": "assertIsNone", "contents": "self.assertIsNone(${1:obj}${2:, msg='${3}'})" }, {"trigger": "assertIsNot", "contents": "self.assertIsNot(${1:expr1}, ${2:expr2}, ${3:msg=None})" }, - {"trigger": "assertDictEqual", "contents": "self.assertDictEqual(d1, d2, msg=None)" }, - {"trigger": "assertDictContainsSubset", "contents": "self.assertDictContainsSubset(subset, dictionary, msg=None)" }, - {"trigger": "assertCountEqual", "contents": "self.assertCountEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, - {"trigger": "assertMultiLineEqual", "contents": "self.assertMultiLineEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertIsNotNone", "contents": "self.assertIsNotNone(${1:obj}${2:, msg='${3}'})" }, {"trigger": "assertLess", "contents": "self.assertLess(${1:a}, ${2:b}, ${3:msg=None})" }, {"trigger": "assertLessEqual", "contents": "self.assertLessEqual(${1:a}, ${2:b}, ${3:msg=None})" }, - {"trigger": "assertGreater", "contents": "self.assertGreater(${1:a}, ${2:b}, ${3:msg=None})" }, - {"trigger": "assertGreaterEqual", "contents": "self.assertGreaterEqual(${1:a}, ${2:b}, ${3:msg=None})" }, - {"trigger": "assertIsNone", "contents": "self.assertIsNone(obj, msg=None)" }, - {"trigger": "assertIsNotNone", "contents": "self.assertIsNotNone(obj, msg=None)" }, - {"trigger": "assertIsInstance", "contents": "self.assertIsInstance(obj, cls, msg=None)" }, - {"trigger": "assertNotIsInstance", "contents": "self.assertNotIsInstance(obj, cls, msg=None)" }, + {"trigger": "assertListEqual", "contents": "self.assertListEqual(list1, list2, msg=None)" }, + {"trigger": "assertLogs", "contents": "self.assertLogs(logger=None, level=None)" }, + {"trigger": "assertMultiLineEqual", "contents": "self.assertMultiLineEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertNotAlmostEqual", "contents": "self.assertNotAlmostEqual(${1:first}, ${2:expected}, places=None, msg=None" }, + {"trigger": "assertNotEqual", "contents": "self.assertNotEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, + {"trigger": "assertNotIn", "contents": "self.assertNotIn(member, container, msg=None)" }, + {"trigger": "assertNotIsInstance", "contents": "self.assertNotIsInstance(${1:obj}, ${2:cls}${3:, msg='${4}'})" }, + {"trigger": "assertNotRegex", "contents": "self.assertNotRegex(text, unexpected_regex, msg=None)" }, + {"trigger": "assertRaises", "contents": "self.assertRaises(${1:exception}, msg='${2}')" }, {"trigger": "assertRaisesRegex", "contents": "self.assertRaisesRegex(${1:exception}, ${2:expected_regex}" }, - {"trigger": "assertWarnsRegex", "contents": "self.assertWarnsRegex(${1:expected_warning}, ${2:expected_regex}" }, {"trigger": "assertRegex", "contents": "self.assertRegex(text, expected_regex, msg=None)" }, - {"trigger": "assertNotRegex", "contents": "self.assertNotRegex(text, unexpected_regex, msg=None)" }, + {"trigger": "assertSequenceEqual", "contents": "self.assertSequenceEqual(seq1, seq2, msg=None, seq_type=None)" }, + {"trigger": "assertSetEqual", "contents": "self.assertSetEqual(set1, set2, msg=None)" }, + {"trigger": "assertTrue", "contents": "self.assertTrue(${1:expr}, ${2:msg=None})" }, + {"trigger": "assertTupleEqual", "contents": "self.assertTupleEqual(tuple1, tuple2, msg=None)" }, + {"trigger": "assertWarns", "contents": "self.assertWarns(${1:expected_warning}, *args, **kwargs)" }, + {"trigger": "assertWarnsRegex", "contents": "self.assertWarnsRegex(${1:expected_warning}, ${2:expected_regex}" }, ] } diff --git a/instantiables.sublime-completions b/instantiables.sublime-completions index 6fcb627..ce802de 100644 --- a/instantiables.sublime-completions +++ b/instantiables.sublime-completions @@ -1,5 +1,5 @@ { - "scope": "source.python - meta.statement.except - meta.statement.with", + "scope": "source.python - meta.statement.except - meta.statement.with - comment - variable - string", "completions": [ From f78f1c728a2c16251f999a643e7bfc2006c5baa7 Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Thu, 1 Mar 2018 01:38:30 +0000 Subject: [PATCH 5/5] Fix assertsions --- assertions.sublime-completions | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/assertions.sublime-completions b/assertions.sublime-completions index 34a8002..dbff606 100644 --- a/assertions.sublime-completions +++ b/assertions.sublime-completions @@ -10,13 +10,13 @@ {"trigger": "assertAlmostEqual", "contents": "self.assertAlmostEqual(${1:first}, ${2:expected}, places=None, msg=None" }, {"trigger": "assertCountEqual", "contents": "self.assertCountEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, - {"trigger": "assertDictContainsSubset", "contents": "self.assertDictContainsSubset(subset, dictionary, msg=None)" }, - {"trigger": "assertDictEqual", "contents": "self.assertDictEqual(d1, d2, msg=None)" }, + {"trigger": "assertDictContainsSubset", "contents": "self.assertDictContainsSubset(${1:subset}, ${2:dictionary}${3:, ${4:msg=None}})" }, + {"trigger": "assertDictEqual", "contents": "self.assertDictEqual(${1:d1}, ${2:d2}${3:, ${4:msg=None}})" }, {"trigger": "assertEqual", "contents": "self.assertEqual(${1:actual}, ${2:expected}${3:, msg='${4}'})" }, {"trigger": "assertFalse", "contents": "self.assertFalse(${1:expr}, '${2}')" }, {"trigger": "assertGreater", "contents": "self.assertGreater(${1:a}, ${2:b}, ${3:msg=None})" }, {"trigger": "assertGreaterEqual", "contents": "self.assertGreaterEqual(${1:a}, ${2:b}, ${3:msg=None})" }, - {"trigger": "assertIn", "contents": "self.assertIn(member, container, msg=None)" }, + {"trigger": "assertIn", "contents": "self.assertIn(${1:member}, ${2:container}${3:, ${4:msg=None}})" }, {"trigger": "assertIs", "contents": "self.assertIs(${1:expr1}, ${2:expr2}, ${3:msg=None})" }, {"trigger": "assertIsInstance", "contents": "self.assertIsInstance(${1:obj}, ${2:cls}${3:, msg='${4}'})" }, {"trigger": "assertIsNone", "contents": "self.assertIsNone(${1:obj}${2:, msg='${3}'})" }, @@ -24,21 +24,21 @@ {"trigger": "assertIsNotNone", "contents": "self.assertIsNotNone(${1:obj}${2:, msg='${3}'})" }, {"trigger": "assertLess", "contents": "self.assertLess(${1:a}, ${2:b}, ${3:msg=None})" }, {"trigger": "assertLessEqual", "contents": "self.assertLessEqual(${1:a}, ${2:b}, ${3:msg=None})" }, - {"trigger": "assertListEqual", "contents": "self.assertListEqual(list1, list2, msg=None)" }, + {"trigger": "assertListEqual", "contents": "self.assertListEqual(${1:list1}, ${2:list2}${3:, ${4:msg=None}})" }, {"trigger": "assertLogs", "contents": "self.assertLogs(logger=None, level=None)" }, {"trigger": "assertMultiLineEqual", "contents": "self.assertMultiLineEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, {"trigger": "assertNotAlmostEqual", "contents": "self.assertNotAlmostEqual(${1:first}, ${2:expected}, places=None, msg=None" }, {"trigger": "assertNotEqual", "contents": "self.assertNotEqual(${1:actual}, ${2:expected}, ${3:msg=None})" }, - {"trigger": "assertNotIn", "contents": "self.assertNotIn(member, container, msg=None)" }, + {"trigger": "assertNotIn", "contents": "self.assertNotIn(${1:member}, ${2:container}${3:, ${4:msg=None}})" }, {"trigger": "assertNotIsInstance", "contents": "self.assertNotIsInstance(${1:obj}, ${2:cls}${3:, msg='${4}'})" }, - {"trigger": "assertNotRegex", "contents": "self.assertNotRegex(text, unexpected_regex, msg=None)" }, + {"trigger": "assertNotRegex", "contents": "self.assertNotRegex(${1:text}, ${2:unexpected_regex}${3:, ${4:msg=None}})" }, {"trigger": "assertRaises", "contents": "self.assertRaises(${1:exception}, msg='${2}')" }, {"trigger": "assertRaisesRegex", "contents": "self.assertRaisesRegex(${1:exception}, ${2:expected_regex}" }, - {"trigger": "assertRegex", "contents": "self.assertRegex(text, expected_regex, msg=None)" }, + {"trigger": "assertRegex", "contents": "self.assertRegex(${1:text}, ${2:expected_regex}${3:, ${4:msg=None}})" }, {"trigger": "assertSequenceEqual", "contents": "self.assertSequenceEqual(seq1, seq2, msg=None, seq_type=None)" }, - {"trigger": "assertSetEqual", "contents": "self.assertSetEqual(set1, set2, msg=None)" }, - {"trigger": "assertTrue", "contents": "self.assertTrue(${1:expr}, ${2:msg=None})" }, - {"trigger": "assertTupleEqual", "contents": "self.assertTupleEqual(tuple1, tuple2, msg=None)" }, + {"trigger": "assertSetEqual", "contents": "self.assertSetEqual(${1:set1}, ${2:set2}${3:, ${4:msg=None}})" }, + {"trigger": "assertTrue", "contents": "self.assertTrue(${1:expr}${2:, ${3:msg=None}})" }, + {"trigger": "assertTupleEqual", "contents": "self.assertTupleEqual(${1:tuple1}, ${2:tuple2}${3:, ${4:msg=None}})" }, {"trigger": "assertWarns", "contents": "self.assertWarns(${1:expected_warning}, *args, **kwargs)" }, {"trigger": "assertWarnsRegex", "contents": "self.assertWarnsRegex(${1:expected_warning}, ${2:expected_regex}" },