Skip to content

Commit 50df6d7

Browse files
patch new line
1 parent 4e3f9ec commit 50df6d7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

codeflash/code_utils/git_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,17 @@ def remove_worktree(worktree_dir: Path) -> None:
259259
def create_diff_from_worktree(worktree_dir: Path, files: list[str], fto_name: str) -> Path:
260260
repository = git.Repo(worktree_dir, search_parent_directories=True)
261261
uni_diff_text = repository.git.diff(None, "HEAD", *files, ignore_blank_lines=True, ignore_space_at_eol=True)
262-
uni_diff_text = uni_diff_text.strip()
262+
263263
if not uni_diff_text:
264264
logger.warning("No changes found in worktree.")
265265
return None
266+
267+
if not uni_diff_text.endswith("\n"):
268+
uni_diff_text += "\n"
269+
266270
# write to patches_dir
267271
patches_dir.mkdir(parents=True, exist_ok=True)
268272
patch_path = patches_dir / f"{worktree_dir.name}.{fto_name}.patch"
269273
with patch_path.open("w", encoding="utf8") as f:
270-
f.write(uni_diff_text + "\n")
274+
f.write(uni_diff_text)
271275
return patch_path

codeflash/lsp/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ 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
5960
args = process_pyproject_config(args)
6061
self.args = args
6162
# avoid initializing the optimizer during initialization, because it can cause an error if the api key is invalid
@@ -77,7 +78,7 @@ def show_message_log(self, message: str, message_type: str) -> None:
7778
"Debug": MessageType.Debug,
7879
}
7980

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

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

0 commit comments

Comments
 (0)