Skip to content

Commit 9a5da91

Browse files
committed
fix(lsp): remove collection-related code and improved test coverage.
1 parent 803df0a commit 9a5da91

File tree

2 files changed

+79
-172
lines changed

2 files changed

+79
-172
lines changed

src/vectorcode/lsp_main.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
file=sys.stderr,
3535
)
3636
sys.exit(1)
37-
from chromadb.errors import InvalidCollectionException
3837

3938
from vectorcode import __version__
4039
from vectorcode.cli_utils import (
@@ -109,7 +108,6 @@ async def execute_command(ls: LanguageServer, args: list[str]):
109108
)
110109
DEFAULT_PROJECT_ROOT = str(parsed_args.project_root)
111110

112-
collection = None
113111
if parsed_args.project_root is not None:
114112
parsed_args.project_root = os.path.abspath(str(parsed_args.project_root))
115113

@@ -188,7 +186,9 @@ async def execute_command(ls: LanguageServer, args: list[str]):
188186
logger.info(f"Retrieved {len(projects)} project(s).")
189187
return projects
190188
case CliAction.vectorise:
191-
assert collection is not None, "Failed to find the correct collection."
189+
assert final_configs.project_root is not None, (
190+
"Failed to find the correct collection."
191+
)
192192
ls.progress.begin(
193193
progress_token,
194194
types.WorkDoneProgressBegin(
@@ -248,10 +248,6 @@ async def execute_command(ls: LanguageServer, args: list[str]):
248248
)
249249
return stats.to_dict()
250250
case CliAction.files:
251-
if collection is None: # pragma: nocover
252-
raise InvalidCollectionException(
253-
f"Failed to find the corresponding collection for {final_configs.project_root}"
254-
)
255251
match final_configs.files_action:
256252
case FilesAction.ls:
257253
return list(

0 commit comments

Comments
 (0)