diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-17 00:06:00 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-17 00:06:00 +0300 |
| commit | dc383b4faef881f3bb22816f42c53a79236a4152 (patch) | |
| tree | 7c6a48487fc1d51fed72ea5d15618d133132cdaa /internal/logging/logging.go | |
| parent | 6a1d48036105e92193aef11a15a77a569eeb1562 (diff) | |
lsp/config: make completion trigger characters configurable
- Add trigger_characters to JSON config and ServerOptions
- Store on server and advertise in initialize
- Update README and example config
- Preserve previous defaults when unset
Diffstat (limited to 'internal/logging/logging.go')
| -rw-r--r-- | internal/logging/logging.go | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/internal/logging/logging.go b/internal/logging/logging.go index 2e4bbc8..80231ab 100644 --- a/internal/logging/logging.go +++ b/internal/logging/logging.go @@ -1,18 +1,18 @@ package logging import ( - "fmt" - "log" + "fmt" + "log" ) // 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" + AnsiRed = "\x1b[31m" + AnsiReset = "\x1b[0m" ) // AnsiBase is the default style: black background + grey foreground. @@ -26,11 +26,11 @@ func Bind(l *log.Logger) { std = l } // Logf prints a formatted message with a module prefix and base ANSI style. func Logf(prefix, format string, args ...any) { - if std == nil { - return - } - msg := fmt.Sprintf(format, args...) - std.Print(AnsiBase + prefix + msg + AnsiReset) + if std == nil { + return + } + msg := fmt.Sprintf(format, args...) + std.Print(AnsiBase + prefix + msg + AnsiReset) } // Logging configuration for previews (shared) @@ -42,12 +42,11 @@ func SetLogPreviewLimit(n int) { logPreviewLimit = n } // PreviewForLog returns the string truncated to the configured preview limit. func PreviewForLog(s string) string { - if logPreviewLimit > 0 { - if len(s) <= logPreviewLimit { - return s - } - return s[:logPreviewLimit] + "…" - } - return s + if logPreviewLimit > 0 { + if len(s) <= logPreviewLimit { + return s + } + return s[:logPreviewLimit] + "…" + } + return s } - |
