summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-10-27 08:35:10 +0200
committerGitHub <noreply@github.com>2020-10-27 07:35:10 +0100
commitda476a872312a4353ed1623c5328be47d1d3b145 (patch)
tree97c148c9572c4a631d6f5ed741bd1c29c6ca0d7f /compiler
parent25955440df3bf32b058ed27bdc2e619874f0d4ee (diff)
downloadNim-da476a872312a4353ed1623c5328be47d1d3b145.tar.gz
fix #15740 --hint:conf now works more reliably (#15741)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/nimconf.nim15
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim
index 3e8c4d194..05f234ce6 100644
--- a/compiler/nimconf.nim
+++ b/compiler/nimconf.nim
@@ -287,16 +287,21 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
     if cfg == DefaultConfig:
       runNimScriptIfExists(pd / DefaultConfigNims)
 
-  for filename in configFiles:
-    # delayed to here so that `hintConf` is honored
-    rawMessage(conf, hintConf, filename.string)
-
   let scriptFile = conf.projectFull.changeFileExt("nims")
+  let isMain = scriptFile == conf.projectFull
+  template showHintConf =
+    for filename in configFiles:
+      # delayed to here so that `hintConf` is honored
+      rawMessage(conf, hintConf, filename.string)
+  if isMain:
+    showHintConf()
+    configFiles.setLen 0
   if conf.command != "nimsuggest":
     runNimScriptIfExists(scriptFile)
   else:
-    if scriptFile != conf.projectFull:
+    if not isMain:
       runNimScriptIfExists(scriptFile)
     else:
       # 'nimsuggest foo.nims' means to just auto-complete the NimScript file
       discard
+  showHintConf()