Skip to content

Commit 9c41957

Browse files
small fixes
1 parent 22b5065 commit 9c41957

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

codeflash/code_utils/git_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def remove_worktree(worktree_dir: Path) -> None:
258258
logger.exception(f"Failed to remove worktree: {worktree_dir}")
259259

260260

261-
def create_diff_from_worktree(worktree_dir: Path, files: list[str], fto_name: str) -> Path:
261+
def create_diff_patch_from_worktree(worktree_dir: Path, files: list[str], fto_name: str) -> Path:
262262
repository = git.Repo(worktree_dir, search_parent_directories=True)
263263
uni_diff_text = repository.git.diff(None, "HEAD", *files, ignore_blank_lines=True, ignore_space_at_eol=True)
264264

codeflash/lsp/beta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pygls import uris
1010

1111
from codeflash.api.cfapi import get_codeflash_api_key, get_user_id
12-
from codeflash.code_utils.git_utils import create_diff_from_worktree
12+
from codeflash.code_utils.git_utils import create_diff_patch_from_worktree
1313
from codeflash.code_utils.shell_utils import save_api_key_to_rc
1414
from codeflash.either import is_successful
1515
from codeflash.lsp.server import CodeflashLanguageServer, CodeflashLanguageServerProtocol
@@ -322,7 +322,7 @@ def perform_function_optimization( # noqa: PLR0911
322322

323323
# generate a patch for the optimization
324324
relative_file_paths = [code_string.file_path for code_string in code_context.read_writable_code.code_strings]
325-
patch_file = create_diff_from_worktree(
325+
patch_file = create_diff_patch_from_worktree(
326326
server.optimizer.current_worktree,
327327
relative_file_paths,
328328
server.optimizer.current_function_optimizer.function_to_optimize.qualified_name,

codeflash/lsp/server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def prepare_optimizer_arguments(self, config_file: Path) -> None:
5656
args.config_file = config_file
5757
args.no_pr = True # LSP server should not create PRs
5858
args.worktree = True
59-
args.verbose = True
6059
args = process_pyproject_config(args)
6160
self.args = args
6261
# avoid initializing the optimizer during initialization, because it can cause an error if the api key is invalid
@@ -78,7 +77,7 @@ def show_message_log(self, message: str, message_type: str) -> None:
7877
"Debug": MessageType.Debug,
7978
}
8079

81-
lsp_message_type = type_mapping.get(message_type, MessageType.Debug)
80+
lsp_message_type = type_mapping.get(message_type, MessageType.Info)
8281

8382
# Send log message to client (appears in output channel)
8483
log_params = LogMessageParams(type=lsp_message_type, message=message)

codeflash/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from codeflash.cli_cmds.cli import parse_args, process_pyproject_config
1010
from codeflash.cli_cmds.cmd_init import CODEFLASH_LOGO, ask_run_end_to_end_test
11-
from codeflash.cli_cmds.console import console, paneled_text
11+
from codeflash.cli_cmds.console import paneled_text
1212
from codeflash.code_utils.checkpoint import ask_should_use_checkpoint_get_functions
1313
from codeflash.code_utils.config_parser import parse_config_file
1414
from codeflash.telemetry import posthog_cf
@@ -17,7 +17,6 @@
1717

1818
def main() -> None:
1919
"""Entry point for the codeflash command-line interface."""
20-
console.quiet = False
2120
paneled_text(
2221
CODEFLASH_LOGO, panel_args={"title": "https://codeflash.ai", "expand": False}, text_args={"style": "bold gold3"}
2322
)

codeflash/optimization/function_optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ def process_review(
12591259
trace_id=self.function_trace_id, is_optimization_found=best_optimization is not None
12601260
)
12611261

1262-
# If worktree mode, do not revert code and helpers, we create snapshot commit after each function optimization
1262+
# If worktree mode, do not revert code and helpers,, otherwise we would have an empty diff when writing the patch in the lsp
12631263
if self.args.worktree:
12641264
return
12651265

codeflash/optimization/optimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from codeflash.code_utils.git_utils import (
1919
check_running_in_git_repo,
2020
create_detached_worktree,
21-
create_diff_from_worktree,
21+
create_diff_patch_from_worktree,
2222
create_worktree_snapshot_commit,
2323
remove_worktree,
2424
)
@@ -346,7 +346,7 @@ def run(self) -> None:
346346
relative_file_paths = [
347347
code_string.file_path for code_string in read_writable_code.code_strings
348348
]
349-
patch_path = create_diff_from_worktree(
349+
patch_path = create_diff_patch_from_worktree(
350350
self.current_worktree,
351351
relative_file_paths,
352352
self.current_function_optimizer.function_to_optimize.qualified_name,

0 commit comments

Comments
 (0)