Skip to content

Commit a292649

Browse files
committed
refactor: change method() to iter_methods()
1 parent 5c3a0ff commit a292649

27 files changed

+106
-80
lines changed

src/lsp_client/capability/notification/did_change_configuration.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator
44
from typing import Any, Protocol, override, runtime_checkable
55

66
from lsp_client.protocol import CapabilityClientProtocol, WorkspaceCapabilityProtocol
@@ -19,8 +19,9 @@ class WithNotifyDidChangeConfiguration(
1919

2020
@override
2121
@classmethod
22-
def methods(cls) -> Sequence[str]:
23-
return (lsp_type.WORKSPACE_DID_CHANGE_CONFIGURATION,)
22+
def iter_methods(cls) -> Iterator[str]:
23+
yield from super().iter_methods()
24+
yield from (lsp_type.WORKSPACE_DID_CHANGE_CONFIGURATION,)
2425

2526
@override
2627
@classmethod

src/lsp_client/capability/notification/text_document_synchronize.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
from lsp_client.protocol import CapabilityClientProtocol, TextDocumentCapabilityProtocol
@@ -21,8 +21,9 @@ class WithNotifyTextDocumentSynchronize(
2121

2222
@override
2323
@classmethod
24-
def methods(cls) -> Sequence[str]:
25-
return (
24+
def iter_methods(cls) -> Iterator[str]:
25+
yield from super().iter_methods()
26+
yield from (
2627
lsp_type.TEXT_DOCUMENT_DID_OPEN,
2728
lsp_type.TEXT_DOCUMENT_DID_CHANGE,
2829
lsp_type.TEXT_DOCUMENT_DID_CLOSE,

src/lsp_client/capability/request/call_hierarchy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
import asyncer
@@ -25,8 +25,9 @@ class WithRequestCallHierarchy(
2525

2626
@override
2727
@classmethod
28-
def methods(cls) -> Sequence[str]:
29-
return (
28+
def iter_methods(cls) -> Iterator[str]:
29+
yield from super().iter_methods()
30+
yield from (
3031
lsp_type.TEXT_DOCUMENT_PREPARE_CALL_HIERARCHY,
3132
lsp_type.CALL_HIERARCHY_INCOMING_CALLS,
3233
lsp_type.CALL_HIERARCHY_OUTGOING_CALLS,

src/lsp_client/capability/request/completion.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
import asyncer
@@ -27,8 +27,9 @@ class WithRequestCompletion(
2727

2828
@override
2929
@classmethod
30-
def methods(cls) -> Sequence[str]:
31-
return (
30+
def iter_methods(cls) -> Iterator[str]:
31+
yield from super().iter_methods()
32+
yield from (
3233
lsp_type.TEXT_DOCUMENT_COMPLETION,
3334
lsp_type.COMPLETION_ITEM_RESOLVE,
3435
)

src/lsp_client/capability/request/declaration.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
from loguru import logger
@@ -23,8 +23,9 @@ class WithRequestDeclaration(
2323

2424
@override
2525
@classmethod
26-
def methods(cls) -> Sequence[str]:
27-
return (lsp_type.TEXT_DOCUMENT_DECLARATION,)
26+
def iter_methods(cls) -> Iterator[str]:
27+
yield from super().iter_methods()
28+
yield from (lsp_type.TEXT_DOCUMENT_DECLARATION,)
2829

2930
@override
3031
@classmethod

src/lsp_client/capability/request/definition.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
from loguru import logger
@@ -26,8 +26,9 @@ class WithRequestDefinition(
2626

2727
@override
2828
@classmethod
29-
def methods(cls) -> Sequence[str]:
30-
return (lsp_type.TEXT_DOCUMENT_DEFINITION,)
29+
def iter_methods(cls) -> Iterator[str]:
30+
yield from super().iter_methods()
31+
yield from (lsp_type.TEXT_DOCUMENT_DEFINITION,)
3132

3233
@override
3334
@classmethod

src/lsp_client/capability/request/document_symbol.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
from loguru import logger
@@ -23,8 +23,9 @@ class WithRequestDocumentSymbol(
2323

2424
@override
2525
@classmethod
26-
def methods(cls) -> Sequence[str]:
27-
return ("text_document/document_symbol",)
26+
def iter_methods(cls) -> Iterator[str]:
27+
yield from super().iter_methods()
28+
yield from ("text_document/document_symbol",)
2829

2930
@override
3031
@classmethod

src/lsp_client/capability/request/hover.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator
44
from typing import Protocol, override, runtime_checkable
55

66
from lsp_client.jsonrpc.id import jsonrpc_uuid
@@ -20,8 +20,9 @@ class WithRequestHover(
2020

2121
@override
2222
@classmethod
23-
def methods(cls) -> Sequence[str]:
24-
return (lsp_type.TEXT_DOCUMENT_HOVER,)
23+
def iter_methods(cls) -> Iterator[str]:
24+
yield from super().iter_methods()
25+
yield from (lsp_type.TEXT_DOCUMENT_HOVER,)
2526

2627
@override
2728
@classmethod

src/lsp_client/capability/request/implementation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
from loguru import logger
@@ -23,8 +23,9 @@ class WithRequestImplementation(
2323

2424
@override
2525
@classmethod
26-
def methods(cls) -> Sequence[str]:
27-
return (lsp_type.TEXT_DOCUMENT_IMPLEMENTATION,)
26+
def iter_methods(cls) -> Iterator[str]:
27+
yield from super().iter_methods()
28+
yield from (lsp_type.TEXT_DOCUMENT_IMPLEMENTATION,)
2829

2930
@override
3031
@classmethod

src/lsp_client/capability/request/inlay_hint.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
3+
from collections.abc import Iterator, Sequence
44
from typing import Protocol, override, runtime_checkable
55

66
import asyncer
@@ -25,8 +25,9 @@ class WithRequestInlayHint(
2525

2626
@override
2727
@classmethod
28-
def methods(cls) -> Sequence[str]:
29-
return (
28+
def iter_methods(cls) -> Iterator[str]:
29+
yield from super().iter_methods()
30+
yield from (
3031
lsp_type.TEXT_DOCUMENT_INLAY_HINT,
3132
lsp_type.INLAY_HINT_RESOLVE,
3233
)

0 commit comments

Comments
 (0)