From d69c6d4f3729374ab40fcebc861e67f2da100ad9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 4 Oct 2023 10:57:03 -0700 Subject: fix: :bug: fix for windows drive difference bug --- .../continuedev/plugins/context_providers/file.py | 23 +++++++++++++++++----- docs/docs/customization/models.md | 2 +- extension/src/continueIdeClient.ts | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/continuedev/src/continuedev/plugins/context_providers/file.py b/continuedev/src/continuedev/plugins/context_providers/file.py index f4fbaf03..4cfbcfdb 100644 --- a/continuedev/src/continuedev/plugins/context_providers/file.py +++ b/continuedev/src/continuedev/plugins/context_providers/file.py @@ -1,11 +1,12 @@ import asyncio import os -from typing import List +from typing import List, Optional from ...core.context import ContextProvider from ...core.main import ContextItem, ContextItemDescription, ContextItemId from ...core.sdk import ContinueSDK from ...libs.util.filter_files import DEFAULT_IGNORE_PATTERNS +from ...libs.util.logging import logger from .util import remove_meilisearch_disallowed_chars MAX_SIZE_IN_CHARS = 50_000 @@ -80,14 +81,26 @@ class FileContextProvider(ContextProvider): async def get_context_item_for_filepath( self, absolute_filepath: str - ) -> ContextItem: + ) -> Optional[ContextItem]: content = await get_file_contents(absolute_filepath, self.sdk) if content is None: return None - relative_to_workspace = os.path.relpath( - absolute_filepath, self.sdk.ide.workspace_directory - ) + workspace_dir = self.sdk.ide.workspace_directory + if ( + os.path.splitdrive(workspace_dir)[0] + != os.path.splitdrive(absolute_filepath)[0] + ): + workspace_dir = ( + os.path.splitdrive(absolute_filepath)[0] + + os.path.splitdrive(workspace_dir)[1] + ) + + try: + relative_to_workspace = os.path.relpath(absolute_filepath, workspace_dir) + except Exception as e: + logger.warning(f"Error getting relative path: {e}") + return None return ContextItem( content=content[: min(2000, len(content))], diff --git a/docs/docs/customization/models.md b/docs/docs/customization/models.md index 29f1ac91..8004130d 100644 --- a/docs/docs/customization/models.md +++ b/docs/docs/customization/models.md @@ -1,6 +1,6 @@ # Models -Continue makes it easy to swap out different LLM providers. Once you've added any of these to your `config.py`, you will be able to switch between them with the model selection dropdown. +Continue makes it easy to swap out different LLM providers. You can either click the "+" button next to the model dropdown to configure in the UI or manually add them to your `config.py`. Once you've done this, you will be able to switch between them with the model selection dropdown. Commercial Models diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 006ac156..f49f0936 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -571,7 +571,7 @@ class IdeProtocolClient { directory: string, recursive: boolean ): Promise { - let nameAndType = ( + const nameAndType = ( await vscode.workspace.fs.readDirectory(uriFromFilePath(directory)) ).filter(([name, type]) => { const DEFAULT_IGNORE_DIRS = [ -- cgit v1.2.3-70-g09d2