improvements to hint:processing: show import stack, distinguish nims, show includes etc (#18372)

* improvements to hint:processing
* fix tests; do not show hintProcessing for nimscript unless given -d:nimHintProcessingNims
* fix trunner and avoid need for -d:nimHintProcessingNims
* fix some tests
This commit is contained in:
Timothee Cour 2021-06-29 22:16:31 -07:00 • committed by GitHub
commit 0483a5ffaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 19 deletions

View file

@ -582,3 +582,15 @@ proc moduleFromRodFile*(g: ModuleGraph; fileIdx: FileIndex;
proc configComplete*(g: ModuleGraph) =
rememberStartupConfig(g.startupPackedConfig, g.config)
from std/strutils import repeat, `%`
proc onProcessing*(graph: ModuleGraph, fileIdx: FileIndex, moduleStatus: string, fromModule: PSym, ) =
let conf = graph.config
let isNimscript = conf.isDefined("nimscript")
if (not isNimscript) or hintProcessing in conf.cmdlineNotes:
let path = toFilenameOption(conf, fileIdx, conf.filenameOption)
let indent = ">".repeat(graph.importStack.len)
let fromModule2 = if fromModule != nil: $fromModule.name.s else: "(toplevel)"
let mode = if isNimscript: "(nims) " else: ""
rawMessage(conf, hintProcessing, "$#$# $#: $#: $#" % [mode, indent, fromModule2, moduleStatus, path])