From 73c6827d02ff62313184e3745fd94c7591c98b61 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 27 Jul 2023 09:58:56 -0700 Subject: fix: :bug: handle when vscode workspace not open --- continuedev/src/continuedev/plugins/context_providers/file.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'continuedev/src') diff --git a/continuedev/src/continuedev/plugins/context_providers/file.py b/continuedev/src/continuedev/plugins/context_providers/file.py index 3e1b12c8..67a79610 100644 --- a/continuedev/src/continuedev/plugins/context_providers/file.py +++ b/continuedev/src/continuedev/plugins/context_providers/file.py @@ -10,7 +10,8 @@ def get_file_contents(filepath: str) -> str: try: with open(filepath, "r") as f: return f.read() - except UnicodeDecodeError: + except Exception as e: + print("Error reading file contents", e) return "" @@ -53,6 +54,12 @@ class FileContextProvider(ContextProvider): for file_name in file_names: filepaths.append(os.path.join(root, file_name)) + if len(filepaths) > 1000: + break + + if len(filepaths) > 1000: + break + return [ContextItem( content=get_file_contents(file)[:min( 2000, len(get_file_contents(file)))], -- cgit v1.2.3-70-g09d2