diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-10-04 10:57:03 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-10-04 10:57:03 -0700 |
commit | d69c6d4f3729374ab40fcebc861e67f2da100ad9 (patch) | |
tree | 3fbd10c01617977a4fc4f333fd5b15bffc288c32 | |
parent | 8093c9d10db9d3084057f4f5ea0278b9b72f5193 (diff) | |
download | sncontinue-d69c6d4f3729374ab40fcebc861e67f2da100ad9.tar.gz sncontinue-d69c6d4f3729374ab40fcebc861e67f2da100ad9.tar.bz2 sncontinue-d69c6d4f3729374ab40fcebc861e67f2da100ad9.zip |
fix: :bug: fix for windows drive difference bug
-rw-r--r-- | continuedev/src/continuedev/plugins/context_providers/file.py | 23 | ||||
-rw-r--r-- | docs/docs/customization/models.md | 2 | ||||
-rw-r--r-- | 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<string[]> { - let nameAndType = ( + const nameAndType = ( await vscode.workspace.fs.readDirectory(uriFromFilePath(directory)) ).filter(([name, type]) => { const DEFAULT_IGNORE_DIRS = [ |