Skip to content

Commit 671f2c1

Browse files
Zhe YuDavidyz
authored andcommitted
fix(cli): Fix LSP server when running from non-project dir
1 parent 03f7a30 commit 671f2c1

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/vectorcode/lsp_main.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ async def execute_command(ls: LanguageServer, args: list[str]):
105105
)
106106
DEFAULT_PROJECT_ROOT = str(parsed_args.project_root)
107107

108+
collection = None
108109
if parsed_args.project_root is not None:
109110
parsed_args.project_root = os.path.abspath(str(parsed_args.project_root))
110111
await make_caches(parsed_args.project_root)
@@ -113,11 +114,12 @@ async def execute_command(ls: LanguageServer, args: list[str]):
113114
].merge_from(parsed_args)
114115
final_configs.pipe = True
115116
client = await get_client(final_configs)
116-
collection = await get_collection(
117-
client=client,
118-
configs=final_configs,
119-
make_if_missing=final_configs.action in {CliAction.vectorise},
120-
)
117+
if final_configs.action in {CliAction.vectorise, CliAction.query}:
118+
collection = await get_collection(
119+
client=client,
120+
configs=final_configs,
121+
make_if_missing=final_configs.action in {CliAction.vectorise},
122+
)
121123
else:
122124
final_configs = parsed_args
123125
client = await get_client(parsed_args)

0 commit comments

Comments
 (0)