fix #8219; nim check/dump shouldn't run single nimscript project [backport: 1.6] (#19641)

* fix #8219; nim check/dump shouldn't run single nimscript project [backport: 1.6]
This commit is contained in:
flywind
2022-03-26 18:50:15 +08:00
committed by GitHub
parent 8cdd8867c0
commit 82319ef00d
3 changed files with 9 additions and 5 deletions

View File

@@ -301,7 +301,7 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
if conf.cmd == cmdNimscript:
showHintConf()
conf.configFiles.setLen 0
if conf.cmd != cmdIdeTools:
if conf.cmd notin {cmdIdeTools, cmdCheck, cmdDump}:
if conf.cmd == cmdNimscript:
runNimScriptIfExists(conf.projectFull, isMain = true)
else:
@@ -311,5 +311,6 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
runNimScriptIfExists(scriptFile, isMain = true)
else:
# 'nimsuggest foo.nims' means to just auto-complete the NimScript file
# `nim check foo.nims' means to check the syntax of the NimScript file
discard
showHintConf()

View File

@@ -249,6 +249,11 @@ tests/newconfig/bar/mfoo.nims""".splitLines
expected.add &"Hint: used config file '{b}' [Conf]\n"
doAssert outp.endsWith expected, outp & "\n" & expected
block: # bug #8219
let file = "tests/newconfig/mconfigcheck.nims"
let cmd = fmt"{nim} check --hints:off {file}"
check execCmdEx(cmd) == ("", 0)
block: # mfoo2.customext
let filename = testsDir / "newconfig/foo2/mfoo2.customext"
let cmd = fmt"{nim} e --hint:conf {filename}"

View File

@@ -1,11 +1,9 @@
discard """
cmd: "nim check $file"
"""
mode = ScriptMode.Verbose
proc build() =
echo "building nim... "
exec "sleep 10"
exec "nonexistant command"
echo getCurrentDir()
echo "hello"
build()