Skip to content

CodeCompletion/python.json #2

Open

Description

You'll want to change the UUID for this, but this is how far I got writing this down this morning. Cheers!

{
    "description": "Textastic Code Completion for Python",
    "uuid": "00000000-0000-4000-8000-000000000000",

    "completionSets": [
        {
            "name": "keyword.control.flow.python",
            "scope": "source.py",
            "strings": [
                "break",
                "continue",
                "elif",
                "else",
                "except",
                "finally",
                "for",
                "if",
                "pass",
                "raise",
                "return",
                "try",
                "while",
                "with",
                "yield"
            ]
        },
        {
            "name": "keyword.operator.logical.python",
            "scope": "source.py",
            "strings": [
                "and",
                "in",
                "is",
                "not",
                "or"
            ]
        },
        {
            "name": "keyword.other.python",
            "scope": "source.py",
            "strings": [
                "as",
                "assert",
                "del",
                "exec",
                "print"
            ]
        },
        {
            "name": "storage.type.class.python",
            "scope": "source.py",
            "strings": [
                "class"
            ]
        },
        {
            "name": "constant.language.python",
            "scope": "source.py",
            "strings": [
                "Ellipsis",
                "False",
                "NotImplemented",
                "True"
            ]
        },
        {
            "name": "support.type.exception.python",
            "scope": "source.py",
            "strings": [
                "ArithmeticError",
                "AssertionError",
                "AttributeError",
                "BaseException",
                "BufferError",
                "BytesWarning",
                "DeprecationWarning",
                "EOFError",
                "EnvironmentError",
                "Exception",
                "FloatingPointError",
                "FutureWarning",
                "GeneratorExit",
                "IOError",
                "ImportError",
                "ImportWarning",
                "IndentationError",
                "IndexError",
                "KeyError",
                "KeyboardInterrupt",
                "LookupError",
                "MemoryError",
                "NameError",
                "NotImplemented",
                "NotImplementedError",
                "OSError",
                "OverflowError",
                "PendingDeprecationWarning",
                "ReferenceError",
                "RuntimeError",
                "RuntimeWarning",
                "StandardError",
                "StopIteration",
                "SyntaxError",
                "SystemError",
                "SystemExit",
                "SytaxWarning",
                "TabError",
                "TypeError",
                "UnboundLocalError",
                "UnicodeDecodeError",
                "UnicodeEncodeError",
                "UnicodeTranslateError",
                "UnicodeWarning",
                "UserWarning",
                "VMSError",
                "ValueError",
                "WindowsError",
                "ZeroDivisionError"
            ]
        },
        {
            "name": "support.function.builtin.python",
            "scope": "source.py",
            "strings": [
                "__import__",
                "abs",
                "all",
                "any",
                "apply",
                "callable",
                "chr",
                "cmp",
                "coerce",
                "compile",
                "delattr",
                "dir",
                "divmod",
                "eval",
                "execfile",
                "filter",
                "getattr",
                "globals",
                "hasattr",
                "hash",
                "hex",
                "id",
                "input",
                "intern",
                "isinstance",
                "issubclass",
                "iter",
                "len",
                "locals",
                "map",
                "max",
                "min",
                "oct",
                "ord",
                "pow",
                "range",
                "raw_input",
                "reduce",
                "reload",
                "repr",
                "round",
                "setattr",
                "sorted",
                "sum",
                "unichr",
                "vars",
                "zip",
            ]
        },
        {
            "name": "support.type.python",
            "scope": "source.py",
            "strings": [
                "basestring",
                "bool",
                "buffer",
                "classmethod",
                "complex",
                "dict",
                "enumerate",
                "file",
                "float",
                "frozenset",
                "int",
                "list",
                "long",
                "object",
                "open",
                "property",
                "reversed",
                "set",
                "slice",
                "staticmethod",
                "str",
                "super",
                "tuple",
                "type",
                "unicode",
                "xrange"
            ]
        },
        {
            "name": "invalid.illegal.name.python",
            "scope": "source.py",
            "strings": [
                "and",
                "as",
                "assert",
                "break",
                "class",
                "continue",
                "def",
                "del",
                "elif",
                "else",
                "except",
                "exec",
                "finally",
                "for",
                "from",
                "global",
                "if",
                "import",
                "in",
                "is",
                "lambda",
                "not",
                "or",
                "pass",
                "print",
                "raise",
                "return",
                "try",
                "while",
                "with",
                "yield"
            ]
        },
        {
            "name": "variable.language.python",
            "scope": "source.py",
            "strings": [
                "self",
                "cls"
            ]
        },
        {
            "name": "support.function.magic.python",
            "scope": "source.py",
            "strings": [
                "__abs__",
                "__add__",
                "__and__",
                "__call__",
                "__cmp__",
                "__coerce__",
                "__complex__",
                "__contains__",
                "__del__",
                "__delattr__",
                "__delete__",
                "__delitem__",
                "__delslice__",
                "__div__",
                "__divmod__",
                "__enter__",
                "__eq__",
                "__exit__",
                "__float__",
                "__floordiv__",
                "__ge__",
                "__get__",
                "__getattr__",
                "__getattribute__",
                "__getitem__",
                "__getslice__",
                "__gt__",
                "__hash__",
                "__hex__",
                "__iadd__",
                "__iand__",
                "__idiv__",
                "__ifloordiv__",
                "__ilshift__",
                "__imod__",
                "__imul__",
                "__init__",
                "__int__",
                "__invert__",
                "__ior__",
                "__ipow__",
                "__irshift__",
                "__isub__",
                "__iter__",
                "__itruediv__",
                "__ixor__",
                "__le__",
                "__len__",
                "__long__",
                "__lshift__",
                "__lt__",
                "__mod__",
                "__mul__",
                "__ne__",
                "__neg__",
                "__new__",
                "__nonzero__",
                "__oct__",
                "__or__",
                "__pos__",
                "__pow__",
                "__radd__",
                "__rand__",
                "__rdiv__",
                "__rdivmod__",
                "__repr__",
                "__rfloordiv__",
                "__rlshift__",
                "__rmod__",
                "__rmul__",
                "__ror__",
                "__rpow__",
                "__rrshift__",
                "__rshift__",
                "__rsub__",
                "__rtruediv__",
                "__rxor__",
                "__set__",
                "__setattr__",
                "__setitem__",
                "__setslice__",
                "__str__",
                "__sub__",
                "__truediv__",
                "__unicode__",
                "__xor__"
            ]
        },
        {
            "name": "support.variable.magic.python",
            "scope": "source.py",
            "strings": [
                "__all__",
                "__bases__",
                "__class__",
                "__debug__",
                "__dict__",
                "__doc__",
                "__file__",
                "__members__",
                "__metaclass__",
                "__methods__",
                "__name__",
                "__slots__",
                "__weakref__"
            ]
        },
        {
            "name": "string.quoted.double.block.sql.python",
            "scope": "source.py",
            "strings": [
                "ALTER",
                "CREATE",
                "DELETE",
                "INSERT",
                "REPLACE",
                "SELECT",
                "UPDATE"
            ]
        }
    ]
}

Activity

  1. ev-w commented on Apr 10, 2020

    @ev-w

    I can't for the life of me figure out how to use this in the app.

  2. suliveevil commented on Apr 18, 2020

    @suliveevil

    I can't for the life of me figure out how to use this in the app.

    It‘s very similar to VSCode’s setting.json

    pattern matches file content and user input
    capture group(in pattern)matches user input
    string is the capture group pattern‘s instance
    replace/append is the snippet you want

  3. niculw commented on Nov 13, 2020

    @niculw

    I know this original thread is very old, but we have gotten no answer? Other than a context part missing, i have no idea how to make this work in the app. I tried copying the contexts from c.json into this, adjust the scope to only include source.py and then change the completionsets to the ones defined, but nada. I get nothing. I wonder if the scope is wrong. And as i have seen you can tap with three fingers to see, however ipadOS now brings up a menu for undo when tapping with 3 fingers.
    Could someone please help?

  4. niculw commented on Nov 13, 2020

    @niculw

    Solved it. I found the shortcut for scope by holding down command. Its Alt shift p. It seems the scope for python files are source.python, not source.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions