summaryrefslogtreecommitdiff
path: root/continuedev/src/continuedev/server
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-07 16:31:44 -0400
committerNate Sesti <sestinj@gmail.com>2023-06-07 16:31:44 -0400
commitf6a6bb137f0aab1e985e3d401e52af38586ddc7a (patch)
treed55d3acf1ab2b881d59afaaae9eb546b1cf9aeab /continuedev/src/continuedev/server
parent37dd4be19f621571788d0a9880ce316ebc6e8e47 (diff)
parent81b38be5b1199e95534b99168465a8cfcef7e1cb (diff)
downloadsncontinue-f6a6bb137f0aab1e985e3d401e52af38586ddc7a.tar.gz
sncontinue-f6a6bb137f0aab1e985e3d401e52af38586ddc7a.tar.bz2
sncontinue-f6a6bb137f0aab1e985e3d401e52af38586ddc7a.zip
Merge branch 'main' into dlt-transform
Diffstat (limited to 'continuedev/src/continuedev/server')
-rw-r--r--continuedev/src/continuedev/server/ide.py15
-rw-r--r--continuedev/src/continuedev/server/ide_protocol.py8
2 files changed, 22 insertions, 1 deletions
diff --git a/continuedev/src/continuedev/server/ide.py b/continuedev/src/continuedev/server/ide.py
index eec5b607..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)
@@ -133,6 +137,15 @@ class IdeProtocolServer(AbstractIdeProtocolServer):
"sessionId": session_id
})
+ async def highlightCode(self, range_in_file: RangeInFile, color: str):
+ await self._send_json("highlightCode", {
+ "rangeInFile": range_in_file.dict(),
+ "color": color
+ })
+
+ 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]
for i in range(len(suggestions)):
diff --git a/continuedev/src/continuedev/server/ide_protocol.py b/continuedev/src/continuedev/server/ide_protocol.py
index 8f155415..4622d6ff 100644
--- a/continuedev/src/continuedev/server/ide_protocol.py
+++ b/continuedev/src/continuedev/server/ide_protocol.py
@@ -82,3 +82,11 @@ class AbstractIdeProtocolServer(ABC):
@abstractmethod
async def getUserSecret(self, key: str):
"""Get a user secret"""
+
+ @abstractmethod
+ async def highlightCode(self, range_in_file: RangeInFile, color: str):
+ """Highlight code"""
+
+ @abstractmethod
+ async def runCommand(self, command: str) -> str:
+ """Run a command"""