diff --git a/codeflash/lsp/lsp_logger.py b/codeflash/lsp/lsp_logger.py index 33b932291..50491c54c 100644 --- a/codeflash/lsp/lsp_logger.py +++ b/codeflash/lsp/lsp_logger.py @@ -110,6 +110,10 @@ def enhanced_log( actual_log_fn(clean_msg, *args, **kwargs) return + if not lsp_enabled: + # it's for LSP and LSP is disabled + return + # ---- LSP logging path ---- if is_normal_text_message: clean_msg = add_heading_tags(clean_msg, tags) diff --git a/codeflash/lsp/lsp_message.py b/codeflash/lsp/lsp_message.py index 20df1e8f4..492535735 100644 --- a/codeflash/lsp/lsp_message.py +++ b/codeflash/lsp/lsp_message.py @@ -5,7 +5,7 @@ from pathlib import Path from typing import Any, Optional -from codeflash.lsp.helpers import replace_quotes_with_backticks, simplify_worktree_paths +from codeflash.lsp.helpers import is_LSP_enabled, replace_quotes_with_backticks, simplify_worktree_paths json_primitive_types = (str, float, int, bool) max_code_lines_before_collapse = 45 @@ -34,6 +34,8 @@ def type(self) -> str: raise NotImplementedError def serialize(self) -> str: + if not is_LSP_enabled(): + return "" from codeflash.lsp.beta import server execution_ctx = server.execution_context_vars.get()