some fixes
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
"input"
|
||||
"output"
|
||||
"dirs"
|
||||
"stage"
|
||||
"args_file"
|
||||
] @property
|
||||
|
||||
[
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user