Skip to content

Commit 55cb7f4

Browse files
send the file paths with the functions in the current diff
1 parent 674e69e commit 55cb7f4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

codeflash/lsp/beta.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ProvideApiKeyParams:
4545
@server.feature("getOptimizableFunctionsInCurrentDiff")
4646
def get_functions_in_current_git_diff(
4747
server: CodeflashLanguageServer, _params: OptimizableFunctionsParams
48-
) -> dict[str, str | list[str]]:
48+
) -> dict[str, str | dict[str, list[str]]]:
4949
functions = get_functions_within_git_diff(uncommitted_changes=True)
5050
file_to_funcs_to_optimize, _ = filter_functions(
5151
modified_functions=functions,
@@ -55,8 +55,10 @@ def get_functions_in_current_git_diff(
5555
module_root=server.optimizer.args.module_root,
5656
previous_checkpoint_functions={},
5757
)
58-
qualified_names: list[str] = [func.qualified_name for funcs in file_to_funcs_to_optimize.values() for func in funcs]
59-
return {"functions": qualified_names, "status": "success"}
58+
file_to_qualified_names: dict[str, list[str]] = {
59+
str(path): [f.qualified_name for f in funcs] for path, funcs in file_to_funcs_to_optimize.items()
60+
}
61+
return {"functions": file_to_qualified_names, "status": "success"}
6062

6163

6264
@server.feature("getOptimizableFunctions")
@@ -143,7 +145,8 @@ def validate_project(server: CodeflashLanguageServer, _params: FunctionOptimizat
143145
server.show_message_log("pyproject.toml is not valid", "Error")
144146
return {
145147
"status": "error",
146-
"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
148+
# keep the error message the same, the extension is matching "pyproject.toml" in the error message to show the codeflash init instructions
149+
"message": "pyproject.toml is not valid",
147150
}
148151

149152
args = process_args(server)

0 commit comments

Comments
 (0)