some fixes

This commit is contained in:
2026-06-10 10:19:25 +03:00
parent 1ef3973a15
commit 2ebf193695
3 changed files with 22 additions and 1 deletions

View File

@@ -75,7 +75,7 @@
}, },
"block-keywords": { "block-keywords": {
"name": "variable.parameter.jdg", "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": { "matcher-keywords": {
"name": "support.function.jdg", "name": "support.function.jdg",

View File

@@ -48,6 +48,8 @@
"input" "input"
"output" "output"
"dirs" "dirs"
"stage"
"args_file"
] @property ] @property
[ [

View File

@@ -86,6 +86,13 @@ func writeBuildText(w io.Writer, b *runner.BuildRun, multi bool) {
fmt.Fprintf(w, "│ %s\n", line) 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") fmt.Fprintf(w, "└─\n")
} }
@@ -265,6 +272,18 @@ func extractTotalScore(data []byte) (float64, error) {
return header.TotalScore, nil 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 { func humanBytes(n int64) string {
const ( const (
KiB = 1024 KiB = 1024