summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-19 22:53:11 +0300
committerPaul Buetow <paul@buetow.org>2025-08-19 22:53:11 +0300
commit904988e3a417b2d3adb88c749429e8685bb346d0 (patch)
tree7e4953b0acf3e656c20354a3f3b94565b9bcdee8
parent8fa3c76907c3e99e75c5828d9b5642646c81205c (diff)
logging: highlight LLM no-op skips in yellow\n\n- Add AnsiYellow to logging utilities\n- Colorize skip logs (no-trigger, short-prefix, busy) in hexai-lsp logs
-rw-r--r--internal/logging/logging.go13
-rw-r--r--internal/lsp/handlers.go6
2 files changed, 10 insertions, 9 deletions
diff --git a/internal/logging/logging.go b/internal/logging/logging.go
index 2975c7a..f90562f 100644
--- a/internal/logging/logging.go
+++ b/internal/logging/logging.go
@@ -8,12 +8,13 @@ import (
// ANSI color utilities shared across Hexai.
const (
- AnsiBgBlack = "\x1b[40m"
- AnsiGrey = "\x1b[90m"
- AnsiCyan = "\x1b[36m"
- AnsiGreen = "\x1b[32m"
- AnsiRed = "\x1b[31m"
- AnsiReset = "\x1b[0m"
+ AnsiBgBlack = "\x1b[40m"
+ AnsiGrey = "\x1b[90m"
+ AnsiCyan = "\x1b[36m"
+ AnsiGreen = "\x1b[32m"
+ AnsiYellow = "\x1b[33m"
+ AnsiRed = "\x1b[31m"
+ AnsiReset = "\x1b[0m"
)
// AnsiBase is the default style: black background + grey foreground.
diff --git a/internal/lsp/handlers.go b/internal/lsp/handlers.go
index 5d2201f..45eaec0 100644
--- a/internal/lsp/handlers.go
+++ b/internal/lsp/handlers.go
@@ -453,7 +453,7 @@ func (s *Server) tryLLMCompletion(p CompletionParams, above, current, below, fun
// Only invoke LLM when triggered by one of our trigger characters.
if !s.isTriggerEvent(p, current) {
- logging.Logf("lsp ", "completion skip=no-trigger line=%d char=%d current=%q", p.Position.Line, p.Position.Character, trimLen(current))
+ logging.Logf("lsp ", "%scompletion skip=no-trigger line=%d char=%d current=%q%s", logging.AnsiYellow, p.Position.Line, p.Position.Character, trimLen(current), logging.AnsiBase)
return []CompletionItem{}, true
}
@@ -484,14 +484,14 @@ func (s *Server) tryLLMCompletion(p CompletionParams, above, current, below, fun
}
start := computeWordStart(current, j)
if j-start < 1 { // require at least 1 identifier char
- logging.Logf("lsp ", "completion skip=short-prefix line=%d char=%d current=%q", p.Position.Line, p.Position.Character, trimLen(current))
+ logging.Logf("lsp ", "%scompletion skip=short-prefix line=%d char=%d current=%q%s", logging.AnsiYellow, p.Position.Line, p.Position.Character, trimLen(current), logging.AnsiBase)
return []CompletionItem{}, true
}
}
}
// Concurrency guard: if another LLM request is running, skip this one.
if !s.tryStartLLM() {
- logging.Logf("lsp ", "completion skip=busy another LLM request in flight")
+ logging.Logf("lsp ", "%scompletion skip=busy another LLM request in flight%s", logging.AnsiYellow, logging.AnsiBase)
return []CompletionItem{}, true
}
sysPrompt, userPrompt := buildPrompts(inParams, p, above, current, below, funcCtx)