<reponame>ginanjarn/pythontools
"""completion handler"""


class Params(dict):
    """completion params"""

    @property
    def uri(self):
        return self["uri"]

    @property
    def row(self):
        return self["location"]["line"]

    @property
    def column(self):
        return self["location"]["character"]

    @classmethod
    def new(cls, uri: str, row: int, column: int, zero_index=True):
        """new completion params"""

        if not zero_index:
            row -= 1
        return cls({"uri": uri, "location": {"line": row, "character": column}})

"""completion handler"""


class Params(dict):
    """completion params"""

    @property
    def uri(self):
        return self["uri"]

    @property
    def row(self):
        return self["location"]["line"]

    @property
    def column(self):
        return self["location"]["character"]

    @classmethod
    def new(cls, uri: str, row: int, column: int, zero_index=True):
        """new completion params"""

        if not zero_index:
            row -= 1
        return cls({"uri": uri, "location": {"line": row, "character": column}})
completion handler completion params new completion params