diff options
-rw-r--r-- | .github/workflows/main.yaml | 25 | ||||
-rw-r--r-- | build.sh | 22 | ||||
-rw-r--r-- | continuedev/src/continuedev/core/lsp.py | 13 | ||||
-rw-r--r-- | continuedev/src/continuedev/core/sdk.py | 5 | ||||
-rw-r--r-- | continuedev/src/continuedev/libs/lspclient/lsp_endpoint.py | 2 |
5 files changed, 60 insertions, 7 deletions
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 49dde09c..0c39c56f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,6 +6,31 @@ on: - main jobs: + pypi-deployment: + runs-on: ubuntu-20.04 + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Install project dependencies + run: cd continuedev && poetry install + + - name: Configure Poetry Token + run: cd continuedev && poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} + + - name: Build and publish the package + run: cd continuedev && poetry publish --build + pyinstaller: strategy: matrix: diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..d7e5aeda --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# 1. Remove unwanted stuff +rm -rf build +rm -rf env +rm -rf dist +rm -rf continuedev/.venv + +# 2. Create a new virtual environment and activate it +python3 -m venv env +source env/bin/activate + +# 3. Install the required packages +pip install -r continuedev/requirements.txt + +pip install pyinstaller + +# 4. Call PyInstaller from within the virtual environment +env/bin/pyinstaller run.spec + +# 5. Deactivate the virtual environment +deactivate
\ No newline at end of file diff --git a/continuedev/src/continuedev/core/lsp.py b/continuedev/src/continuedev/core/lsp.py index 0f4d5a86..86923fb7 100644 --- a/continuedev/src/continuedev/core/lsp.py +++ b/continuedev/src/continuedev/core/lsp.py @@ -1,3 +1,4 @@ +import asyncio import os import socket import subprocess @@ -57,7 +58,7 @@ class SocketFileWrapper: return self.sockfile.close() -def create_json_rpc_endpoint(use_subprocess: Optional[str] = None): +async def create_json_rpc_endpoint(use_subprocess: Optional[str] = None): if use_subprocess is None: try: threading.Thread( @@ -67,6 +68,8 @@ def create_json_rpc_endpoint(use_subprocess: Optional[str] = None): except Exception as e: logger.warning("Could not start TCP server: %s", e) + await asyncio.sleep(2) + # Connect to the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("localhost", 8080)) @@ -100,8 +103,10 @@ def uri_to_filename(uri: str) -> str: return uri -def create_lsp_client(workspace_dir: str, use_subprocess: Optional[str] = None): - json_rpc_endpoint, process = create_json_rpc_endpoint(use_subprocess=use_subprocess) +async def create_lsp_client(workspace_dir: str, use_subprocess: Optional[str] = None): + json_rpc_endpoint, process = await create_json_rpc_endpoint( + use_subprocess=use_subprocess + ) lsp_endpoint = LspEndpoint(json_rpc_endpoint) lsp_client = LspClient(lsp_endpoint) capabilities = { @@ -282,7 +287,7 @@ class ContinueLSPClient(BaseModel): return original_dict async def start(self): - self.lsp_client, self.lsp_process = create_lsp_client( + self.lsp_client, self.lsp_process = await create_lsp_client( self.workspace_dir, use_subprocess=self.use_subprocess ) diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py index ddcf6e55..658848c8 100644 --- a/continuedev/src/continuedev/core/sdk.py +++ b/continuedev/src/continuedev/core/sdk.py @@ -97,11 +97,10 @@ class ContinueSDK(AbstractContinueSDK): try: sdk.lsp = ContinueLSPClient( workspace_dir=sdk.ide.workspace_directory, - # use_subprocess="python3.10 -m pylsp", ) await sdk.lsp.start() - except: - logger.warning("Failed to start LSP client", exc_info=True) + except Exception as e: + logger.warning(f"Failed to start LSP client: {e}", exc_info=True) sdk.lsp = None # create_async_task( diff --git a/continuedev/src/continuedev/libs/lspclient/lsp_endpoint.py b/continuedev/src/continuedev/libs/lspclient/lsp_endpoint.py index 14d2ca07..9b37a06d 100644 --- a/continuedev/src/continuedev/libs/lspclient/lsp_endpoint.py +++ b/continuedev/src/continuedev/libs/lspclient/lsp_endpoint.py @@ -1,6 +1,7 @@ from __future__ import print_function import threading +import time class LspEndpoint(threading.Thread): @@ -27,6 +28,7 @@ class LspEndpoint(threading.Thread): def run(self): while not self.shutdown_flag: + time.sleep(0.1) jsonrpc_message = self.json_rpc_endpoint.recv_response() if jsonrpc_message is None: |