summaryrefslogtreecommitdiff
path: root/server/continuedev/plugins/steps/draft/abstract_method.py
blob: 7ceefe9b316269e1964e1ccef325f01014e45867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from ....core.main import Step
from ....core.sdk import ContinueSDK


class ImplementAbstractMethodStep(Step):
    name: str = "Implement abstract method for all subclasses"
    method_name: str
    class_name: str

    async def run(self, sdk: ContinueSDK):
        if sdk.lsp is None:
            self.description = "Language Server Protocol is not enabled"
            return

        implementations = await sdk.lsp.go_to_implementations(self.class_name)

        for implementation in implementations:
            await sdk.edit_file(
                range_in_files=[implementation.range_in_file],
                prompt=f"Implement method `{self.method_name}` for this subclass of `{self.class_name}`",
            )