From 7138abff4bc28bfc3699a607a84263c9d5a84940 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sun, 17 Jun 2018 17:44:31 -0700 Subject: [PATCH] Expose (some) span information in TTY output --- src/ShellCheck/Formatter/TTY.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ShellCheck/Formatter/TTY.hs b/src/ShellCheck/Formatter/TTY.hs index 27d5065..f54a0b3 100644 --- a/src/ShellCheck/Formatter/TTY.hs +++ b/src/ShellCheck/Formatter/TTY.hs @@ -78,7 +78,14 @@ outputForFile color sys comments = do cuteIndent :: PositionedComment -> String cuteIndent comment = replicate (fromIntegral $ colNo comment - 1) ' ' ++ - "^-- " ++ code (codeNo comment) ++ ": " ++ messageText comment + makeArrow ++ " " ++ code (codeNo comment) ++ ": " ++ messageText comment + where + arrow n = '^' : replicate (fromIntegral $ n-2) '-' ++ "^" + makeArrow = + let sameLine = lineNo comment == endLineNo comment + delta = endColNo comment - colNo comment + in + if sameLine && delta > 2 && delta < 32 then arrow delta else "^--" code code = "SC" ++ show code -- GitLab