From 55cb7f49faccea143b4fb0fdf4b968370afa34d3 Mon Sep 17 00:00:00 2001 From: ali Date: Mon, 25 Aug 2025 21:08:07 +0300 Subject: [PATCH 1/2] send the file paths with the functions in the current diff --- codeflash/lsp/beta.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/codeflash/lsp/beta.py b/codeflash/lsp/beta.py index 77d87e8a6..dcf1ecd65 100644 --- a/codeflash/lsp/beta.py +++ b/codeflash/lsp/beta.py @@ -45,7 +45,7 @@ class ProvideApiKeyParams: @server.feature("getOptimizableFunctionsInCurrentDiff") def get_functions_in_current_git_diff( server: CodeflashLanguageServer, _params: OptimizableFunctionsParams -) -> dict[str, str | list[str]]: +) -> dict[str, str | dict[str, list[str]]]: functions = get_functions_within_git_diff(uncommitted_changes=True) file_to_funcs_to_optimize, _ = filter_functions( modified_functions=functions, @@ -55,8 +55,10 @@ def get_functions_in_current_git_diff( module_root=server.optimizer.args.module_root, previous_checkpoint_functions={}, ) - qualified_names: list[str] = [func.qualified_name for funcs in file_to_funcs_to_optimize.values() for func in funcs] - return {"functions": qualified_names, "status": "success"} + file_to_qualified_names: dict[str, list[str]] = { + str(path): [f.qualified_name for f in funcs] for path, funcs in file_to_funcs_to_optimize.items() + } + return {"functions": file_to_qualified_names, "status": "success"} @server.feature("getOptimizableFunctions") @@ -143,7 +145,8 @@ def validate_project(server: CodeflashLanguageServer, _params: FunctionOptimizat server.show_message_log("pyproject.toml is not valid", "Error") return { "status": "error", - "message": "pyproject.toml is not valid", # keep the error message the same, the extension is matching "pyproject.toml" in the error message to show the codeflash init instructions + # keep the error message the same, the extension is matching "pyproject.toml" in the error message to show the codeflash init instructions + "message": "pyproject.toml is not valid", } args = process_args(server) From 90ebac354c66dda842b93e0c72b3e7f844ca62f8 Mon Sep 17 00:00:00 2001 From: ali Date: Tue, 26 Aug 2025 12:50:00 +0300 Subject: [PATCH 2/2] revert comment --- codeflash/lsp/beta.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/codeflash/lsp/beta.py b/codeflash/lsp/beta.py index dcf1ecd65..433603d36 100644 --- a/codeflash/lsp/beta.py +++ b/codeflash/lsp/beta.py @@ -145,8 +145,7 @@ def validate_project(server: CodeflashLanguageServer, _params: FunctionOptimizat server.show_message_log("pyproject.toml is not valid", "Error") return { "status": "error", - # keep the error message the same, the extension is matching "pyproject.toml" in the error message to show the codeflash init instructions - "message": "pyproject.toml is not valid", + "message": "pyproject.toml is not valid", # keep the error message the same, the extension is matching "pyproject.toml" in the error message to show the codeflash init instructions } args = process_args(server)