From 2ebf1936959e8910cd0d30900a9ce48e98fecea5 Mon Sep 17 00:00:00 2001 From: Mikhail Kornilovich Date: Wed, 10 Jun 2026 10:19:25 +0300 Subject: [PATCH] some fixes --- .../vscode-jdg/syntaxes/jdg.tmLanguage.json | 2 +- editor/zed/languages/jdg/highlights.scm | 2 ++ reporter/reporter.go | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/editor/vscode-jdg/syntaxes/jdg.tmLanguage.json b/editor/vscode-jdg/syntaxes/jdg.tmLanguage.json index 3c9beeb..d90f6ca 100644 --- a/editor/vscode-jdg/syntaxes/jdg.tmLanguage.json +++ b/editor/vscode-jdg/syntaxes/jdg.tmLanguage.json @@ -75,7 +75,7 @@ }, "block-keywords": { "name": "variable.parameter.jdg", - "match": "\\b(?:weight|scoring|stdin|stdout|stderr|args|exitCode|input|dirs)\\b" + "match": "\\b(?:weight|scoring|stdin|stdout|stderr|args|args_file|exitCode|input|dirs|stage)\\b" }, "matcher-keywords": { "name": "support.function.jdg", diff --git a/editor/zed/languages/jdg/highlights.scm b/editor/zed/languages/jdg/highlights.scm index b2d9590..45954d1 100644 --- a/editor/zed/languages/jdg/highlights.scm +++ b/editor/zed/languages/jdg/highlights.scm @@ -48,6 +48,8 @@ "input" "output" "dirs" + "stage" + "args_file" ] @property [ diff --git a/reporter/reporter.go b/reporter/reporter.go index 7b50976..db222c6 100644 --- a/reporter/reporter.go +++ b/reporter/reporter.go @@ -86,6 +86,13 @@ func writeBuildText(w io.Writer, b *runner.BuildRun, multi bool) { fmt.Fprintf(w, "│ %s\n", line) } } + + if tr.Status != runner.StatusPass && strings.TrimSpace(tr.ActualStderr) != "" { + fmt.Fprintf(w, "│ ── stderr ──\n") + for _, line := range clampLines(tr.ActualStderr, 10) { + fmt.Fprintf(w, "│ %s\n", line) + } + } } fmt.Fprintf(w, "└─\n") } @@ -265,6 +272,18 @@ func extractTotalScore(data []byte) (float64, error) { return header.TotalScore, nil } +// clampLines returns up to max lines of s (trailing newline ignored), appending +// a truncation note when more lines were omitted. +func clampLines(s string, max int) []string { + s = strings.TrimRight(s, "\n") + lines := strings.Split(s, "\n") + if len(lines) <= max { + return lines + } + out := append([]string{}, lines[:max]...) + return append(out, fmt.Sprintf("... (%d more lines)", len(lines)-max)) +} + func humanBytes(n int64) string { const ( KiB = 1024