diff options
author | Adam Strzelecki <ono@java.pl> | 2015-04-20 22:02:25 +0200 |
---|---|---|
committer | Adam Strzelecki <ono@java.pl> | 2015-04-21 11:32:12 +0200 |
commit | 69ed78b30f1627897b2e650afb9dfb5bd867b2d3 (patch) | |
tree | eb35aaeb0d6980a9c0cefdf50fce1d794bef0ae5 /compiler | |
parent | d203d6fad44547d2291e33712057d154e18c0361 (diff) | |
download | Nim-69ed78b30f1627897b2e650afb9dfb5bd867b2d3.tar.gz |
msg: Output column numbers starting from 1
Most of editors/IDEs expect column numbers to start from 1, so (1, 1) means beginning of the file. This change applies only to diagnostics output, however Nim will still internally number columns starting from 0.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/msgs.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 778b839f3..7681b4eb8 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -804,8 +804,11 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, ignoreMsg = optHints notin gOptions or msg notin gNotes frmt = PosHintFormat inc(gHintCounter) + # NOTE: currently line info line numbers start with 1, + # but column numbers start with 0, however most editors expect + # first column to be 1, so we need to +1 here let s = frmt % [toMsgFilename(info), coordToStr(info.line), - coordToStr(info.col), getMessageStr(msg, arg)] + coordToStr(info.col+1), getMessageStr(msg, arg)] if not ignoreMsg and not ignoreMsgBecauseOfIdeTools(msg): msgWriteln(s) if optPrintSurroundingSrc and msg in errMin..errMax: |