diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-06-06 17:50:50 -0400 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-06-06 17:50:50 -0400 |
commit | 881718c4c7f58837a8a208930e7d2c69b9433fd7 (patch) | |
tree | 1d86b8cb99f036fd80987e0c3b16fee52f382c02 /continuedev/src/continuedev/server | |
parent | 5cb69176f731d6e93802e29eb37c5c5d83003be2 (diff) | |
download | sncontinue-881718c4c7f58837a8a208930e7d2c69b9433fd7.tar.gz sncontinue-881718c4c7f58837a8a208930e7d2c69b9433fd7.tar.bz2 sncontinue-881718c4c7f58837a8a208930e7d2c69b9433fd7.zip |
trying to reliably capture terminal output in vsc
Diffstat (limited to 'continuedev/src/continuedev/server')
-rw-r--r-- | continuedev/src/continuedev/server/ide.py | 12 | ||||
-rw-r--r-- | continuedev/src/continuedev/server/ide_protocol.py | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/continuedev/src/continuedev/server/ide.py b/continuedev/src/continuedev/server/ide.py index 073e1dba..007eb2b4 100644 --- a/continuedev/src/continuedev/server/ide.py +++ b/continuedev/src/continuedev/server/ide.py @@ -76,6 +76,10 @@ class GetUserSecretResponse(BaseModel): value: str +class RunCommandResponse(BaseModel): + output: str + + T = TypeVar("T", bound=BaseModel) @@ -110,7 +114,7 @@ class IdeProtocolServer(AbstractIdeProtocolServer): fileEdits = list( map(lambda d: FileEditWithFullContents.parse_obj(d), data["fileEdits"])) self.onFileEdits(fileEdits) - elif message_type in ["highlightedCode", "openFiles", "readFile", "editFile", "workspaceDirectory", "getUserSecret"]: + elif message_type in ["highlightedCode", "openFiles", "readFile", "editFile", "workspaceDirectory", "getUserSecret", "runCommand"]: self.sub_queue.post(message_type, data) else: raise ValueError("Unknown message type", message_type) @@ -139,10 +143,8 @@ class IdeProtocolServer(AbstractIdeProtocolServer): "color": color }) - async def runCommand(self, command: str): - await self._send_json("runCommand", { - "command": command - }) + async def runCommand(self, command: str) -> str: + return (await self._send_and_receive_json({"command": command}, RunCommandResponse, "runCommand")).output async def showSuggestionsAndWait(self, suggestions: List[FileEdit]) -> bool: ids = [str(uuid.uuid4()) for _ in suggestions] diff --git a/continuedev/src/continuedev/server/ide_protocol.py b/continuedev/src/continuedev/server/ide_protocol.py index f42de68f..4622d6ff 100644 --- a/continuedev/src/continuedev/server/ide_protocol.py +++ b/continuedev/src/continuedev/server/ide_protocol.py @@ -88,5 +88,5 @@ class AbstractIdeProtocolServer(ABC): """Highlight code""" @abstractmethod - async def runCommand(self, command: str): + async def runCommand(self, command: str) -> str: """Run a command""" |