Skip to content

Commit

Permalink
mypy spaghetti
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Apr 29, 2024
1 parent 349edc1 commit 83f6236
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions sansio_lsp_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
CompletionItem,
Request,
JSONDict,
JSONList,
TextDocumentItem,
TextDocumentIdentifier,
VersionedTextDocumentIdentifier,
Expand Down Expand Up @@ -209,8 +210,8 @@ def _send_notification(

def _send_response(
self,
id: int,
result: t.Optional[JSONDict] = None,
id: int | str,
result: t.Optional[t.Union[JSONDict, JSONList]] = None,
error: t.Optional[JSONDict] = None,
) -> None:
self._send_buf += _make_response(id=id, result=result, error=error)
Expand Down
6 changes: 3 additions & 3 deletions sansio_lsp_client/io_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pydantic import parse_obj_as

from .structs import Request, Response, JSONDict
from .structs import Request, Response, JSONDict, JSONList


def _make_headers(content_length: int, encoding: str = "utf-8") -> bytes:
Expand Down Expand Up @@ -46,8 +46,8 @@ def _make_request(


def _make_response(
id: int,
result: t.Optional[JSONDict] = None,
id: int | str, # TODO: does this make sense?
result: t.Optional[t.Union[JSONDict, JSONList]] = None,
error: t.Optional[JSONDict] = None,
*,
encoding: str = "utf-8",
Expand Down
1 change: 1 addition & 0 deletions sansio_lsp_client/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# t.List['JSONValue'], t.Dict[str, 'JSONValue']]
# JSONDict = t.Dict[str, JSONValue]
JSONDict = t.Dict[str, t.Any]
JSONList = t.List[t.Any]

Id = t.Union[int, str]

Expand Down

0 comments on commit 83f6236

Please sign in to comment.