Skip to content

Commit 8d54ab6

Browse files
force lsp log (tag)
1 parent 5dc178c commit 8d54ab6

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

codeflash/lsp/lsp_logger.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
@dataclass
1111
class LspMessageTags:
1212
# always set default values for message tags
13-
not_lsp: bool = False
14-
loading: bool = False
13+
not_lsp: bool = False # !lsp (prevent the message from being sent to the LSP)
14+
force_lsp: bool = False # lsp (you can use this to force a message to be sent to the LSP even if the level is not supported)
15+
loading: bool = False # loading (you can use this to indicate that the message is a loading message)
1516

16-
h1: bool = False
17-
h2: bool = False
18-
h3: bool = False
19-
h4: bool = False
17+
h1: bool = False # h1
18+
h2: bool = False # h2
19+
h3: bool = False # h3
20+
h4: bool = False # h4
2021

2122

2223
def add_heading_tags(msg: str, tags: LspMessageTags) -> str:
@@ -41,6 +42,8 @@ def extract_tags(msg: str) -> tuple[LspMessageTags, str]:
4142
tags = [tag.strip() for tag in parts[0].split(",")]
4243
if "!lsp" in tags:
4344
message_tags.not_lsp = True
45+
if "lsp" in tags:
46+
message_tags.force_lsp = True
4447
if "loading" in tags:
4548
message_tags.loading = True
4649
if "h1" in tags:
@@ -86,7 +89,8 @@ def enhanced_log(
8689
return
8790

8891
#### LSP mode ####
89-
if tags.not_lsp or level not in supported_lsp_log_levels:
92+
unsupported_level = level not in supported_lsp_log_levels
93+
if not tags.force_lsp and (tags.not_lsp or unsupported_level):
9094
return
9195

9296
if is_normal_text_message:

codeflash/optimization/function_optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def determine_best_candidate(
516516
)
517517
if not did_update:
518518
logger.warning(
519-
"No functions were replaced in the optimized code. Skipping optimization candidate."
519+
"lsp|tags|No functions were replaced in the optimized code. Skipping optimization candidate."
520520
)
521521
console.rule()
522522
continue

0 commit comments

Comments
 (0)