diff options
-rwxr-xr-x | compiler/commands.nim | 3 | ||||
-rwxr-xr-x | compiler/msgs.nim | 14 | ||||
-rwxr-xr-x | compiler/options.nim | 1 | ||||
-rwxr-xr-x | doc/advopt.txt | 1 |
4 files changed, 16 insertions, 3 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim index 4b9a47d37..8c0e9a784 100755 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -458,6 +458,9 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = of "stdout": expectNoArg(switch, arg, pass, info) incl(gGlobalOptions, optStdout) + of "listfullpaths": + expectNoArg(switch, arg, pass, info) + gListFullPaths = true else: if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg) else: InvalidCmdLineOption(pass, switch, info) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 240115817..d88e4a513 100755 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -531,7 +531,15 @@ proc ToFilename*(fileIdx: int32): string = proc toFullPath*(info: TLineInfo): string = if info.fileIndex < 0: result = "???" else: result = fileInfos[info.fileIndex].fullPath - + +proc ToMsgFilename*(info: TLineInfo): string = + if info.fileIndex < 0: result = "???" + else: + if gListFullPaths: + result = fileInfos[info.fileIndex].fullPath + else: + result = fileInfos[info.fileIndex].projPath + proc ToLinenumber*(info: TLineInfo): int {.inline.} = result = info.line @@ -622,7 +630,7 @@ proc writeContext(lastinfo: TLineInfo) = var info = lastInfo for i in countup(0, len(msgContext) - 1): if msgContext[i] != lastInfo and msgContext[i] != info: - MsgWriteln(posContextFormat % [toFilename(msgContext[i]), + MsgWriteln(posContextFormat % [toMsgFilename(msgContext[i]), coordToStr(msgContext[i].line), coordToStr(msgContext[i].col), getMessageStr(errInstantiationFrom, "")]) @@ -676,7 +684,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, ignoreMsg = optHints notin gOptions or msg notin gNotes frmt = posHintFormat inc(gHintCounter) - let s = frmt % [toFilename(info), coordToStr(info.line), + let s = frmt % [toMsgFilename(info), coordToStr(info.line), coordToStr(info.col), getMessageStr(msg, arg)] if not ignoreMsg: MsgWriteln(s) diff --git a/compiler/options.nim b/compiler/options.nim index 6df29d85f..28382f9ba 100755 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -97,6 +97,7 @@ var gNumberOfProcessors*: int # number of processors gWholeProject*: bool # for 'doc2': output any dependency + gListFullPaths*: bool const genSubDir* = "nimcache" diff --git a/doc/advopt.txt b/doc/advopt.txt index bd387e041..5d3544a76 100755 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -21,6 +21,7 @@ Advanced options: -m, --mainmodule:FILE set the project main module -o, --out:FILE set the output filename --stdout output to stdout + --listFullPaths list full paths in messages -w, --warnings:on|off turn all warnings on|off --warning[X]:on|off turn specific warning X on|off --hints:on|off turn all hints on|off |