fix: 🐛 temporarily disable lsp before fixing w/ vscode

This commit is contained in:
Nate Sesti 2023-10-02 15:11:47 -07:00
parent 0f86a69e4a
commit 98f340bd97
4 changed files with 30 additions and 34 deletions

View file

@ -147,8 +147,6 @@ class Autopilot(ContinueBaseModel):
self.started = True
async def cleanup(self):
if self.continue_sdk.lsp is not None:
await self.continue_sdk.lsp.stop()
stop_meilisearch()
class Config:

View file

@ -4,12 +4,9 @@ from typing import List, Literal, Optional
import aiohttp
from pydantic import BaseModel
from pylsp.python_lsp import PythonLSPServer, start_ws_lang_server
from ..libs.util.logging import logger
from ..models.filesystem import RangeInFile
from ..models.main import Position, Range
from ..server.meilisearch_server import kill_proc
def filepath_to_uri(filename: str) -> str:
@ -266,21 +263,23 @@ class LSPClient:
async def start_language_server() -> threading.Thread:
try:
kill_proc(PORT)
thread = threading.Thread(
target=start_ws_lang_server,
args=(PORT, False, PythonLSPServer),
)
thread.daemon = True
thread.start()
"""Manually start the python language server. Not used currently."""
raise NotImplementedError()
# try:
# kill_proc(PORT)
# thread = threading.Thread(
# target=start_ws_lang_server,
# args=(PORT, False, PythonLSPServer),
# )
# thread.daemon = True
# thread.start()
except Exception as e:
logger.warning("Could not start TCP server: %s", e)
# except Exception as e:
# logger.warning("Could not start TCP server: %s", e)
await asyncio.sleep(2)
# await asyncio.sleep(2)
return thread
# return thread
class DocumentSymbol(BaseModel):

View file

@ -3,7 +3,6 @@ import traceback
from typing import Coroutine, List, Optional, Union
from ..libs.llm import LLM
from ..libs.util.create_async_task import create_async_task
from ..libs.util.devdata import dev_data_logger
from ..libs.util.logging import logger
from ..libs.util.paths import getConfigFilePath, getDiffsFolderPath
@ -97,19 +96,19 @@ class ContinueSDK(AbstractContinueSDK):
await sdk.models.start(sdk)
# Start LSP
async def start_lsp():
try:
sdk.lsp = ContinueLSPClient(
workspace_dir=sdk.ide.workspace_directory,
)
await sdk.lsp.start()
except Exception as e:
logger.warning(f"Failed to start LSP client: {e}", exc_info=False)
sdk.lsp = None
# async def start_lsp():
# try:
# sdk.lsp = ContinueLSPClient(
# workspace_dir=sdk.ide.workspace_directory,
# )
# await sdk.lsp.start()
# except Exception as e:
# logger.warning(f"Failed to start LSP client: {e}", exc_info=False)
# sdk.lsp = None
create_async_task(
start_lsp(), on_error=lambda e: logger.error("Failed to setup LSP: %s", e)
)
# create_async_task(
# start_lsp(), on_error=lambda e: logger.error("Failed to setup LSP: %s", e)
# )
# When the config is loaded, setup posthog logger
posthog_logger.setup(sdk.ide.unique_id, sdk.config.allow_anonymous_telemetry)

View file

@ -25,7 +25,7 @@ class URLContextProvider(ContextProvider):
)
# Static items loaded from preset_urls
_static_url_context_items: List[ContextItem] = []
static_url_context_items: List[ContextItem] = []
# There is only a single dynamic url context item, so it has a static id
_DYNAMIC_URL_CONTEXT_ITEM_ID = "url"
@ -68,18 +68,18 @@ class URLContextProvider(ContextProvider):
return soup.get_text(), title
async def provide_context_items(self, workspace_dir: str) -> List[ContextItem]:
self._static_url_context_items = [
self.static_url_context_items = [
self.static_url_context_item_from_url(url) for url in self.preset_urls
]
return [self.DYNAMIC_CONTEXT_ITEM] + self._static_url_context_items
return [self.DYNAMIC_CONTEXT_ITEM] + self.static_url_context_items
async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
# Check if the item is a static item
matching_static_item = next(
(
item
for item in self._static_url_context_items
for item in self.static_url_context_items
if item.description.id.item_id == id.item_id
),
None,