Wait until the end to print hint Conf (#7931)
This commit is contained in:
parent
582786d068
commit
59ba1e77af
1 changed files with 18 additions and 7 deletions
|
|
@ -201,7 +201,8 @@ proc parseAssignment(L: var TLexer, tok: var TToken;
|
||||||
else:
|
else:
|
||||||
processSwitch(s, val, passPP, info, config)
|
processSwitch(s, val, passPP, info, config)
|
||||||
|
|
||||||
proc readConfigFile(filename: string; cache: IdentCache; config: ConfigRef) =
|
proc readConfigFile(
|
||||||
|
filename: string; cache: IdentCache; config: ConfigRef): bool =
|
||||||
var
|
var
|
||||||
L: TLexer
|
L: TLexer
|
||||||
tok: TToken
|
tok: TToken
|
||||||
|
|
@ -216,7 +217,7 @@ proc readConfigFile(filename: string; cache: IdentCache; config: ConfigRef) =
|
||||||
while tok.tokType != tkEof: parseAssignment(L, tok, config, condStack)
|
while tok.tokType != tkEof: parseAssignment(L, tok, config, condStack)
|
||||||
if len(condStack) > 0: lexMessage(L, errGenerated, "expected @end")
|
if len(condStack) > 0: lexMessage(L, errGenerated, "expected @end")
|
||||||
closeLexer(L)
|
closeLexer(L)
|
||||||
rawMessage(config, hintConf, filename)
|
return true
|
||||||
|
|
||||||
proc getUserConfigPath(filename: string): string =
|
proc getUserConfigPath(filename: string): string =
|
||||||
result = joinPath(getConfigDir(), filename)
|
result = joinPath(getConfigDir(), filename)
|
||||||
|
|
@ -232,27 +233,37 @@ proc getSystemConfigPath(conf: ConfigRef; filename: string): string =
|
||||||
|
|
||||||
proc loadConfigs*(cfg: string; cache: IdentCache; conf: ConfigRef) =
|
proc loadConfigs*(cfg: string; cache: IdentCache; conf: ConfigRef) =
|
||||||
setDefaultLibpath(conf)
|
setDefaultLibpath(conf)
|
||||||
|
|
||||||
|
var configFiles = newSeq[string]()
|
||||||
|
|
||||||
|
template readConfigFile(path: string) =
|
||||||
|
let configPath = path
|
||||||
|
if readConfigFile(configPath, cache, conf):
|
||||||
|
add(configFiles, configPath)
|
||||||
|
|
||||||
if optSkipConfigFile notin conf.globalOptions:
|
if optSkipConfigFile notin conf.globalOptions:
|
||||||
readConfigFile(getSystemConfigPath(conf, cfg), cache, conf)
|
readConfigFile(getSystemConfigPath(conf, cfg))
|
||||||
|
|
||||||
if optSkipUserConfigFile notin conf.globalOptions:
|
if optSkipUserConfigFile notin conf.globalOptions:
|
||||||
readConfigFile(getUserConfigPath(cfg), cache, conf)
|
readConfigFile(getUserConfigPath(cfg))
|
||||||
|
|
||||||
let pd = if conf.projectPath.len > 0: conf.projectPath else: getCurrentDir()
|
let pd = if conf.projectPath.len > 0: conf.projectPath else: getCurrentDir()
|
||||||
if optSkipParentConfigFiles notin conf.globalOptions:
|
if optSkipParentConfigFiles notin conf.globalOptions:
|
||||||
for dir in parentDirs(pd, fromRoot=true, inclusive=false):
|
for dir in parentDirs(pd, fromRoot=true, inclusive=false):
|
||||||
readConfigFile(dir / cfg, cache, conf)
|
readConfigFile(dir / cfg)
|
||||||
|
|
||||||
if optSkipProjConfigFile notin conf.globalOptions:
|
if optSkipProjConfigFile notin conf.globalOptions:
|
||||||
readConfigFile(pd / cfg, cache, conf)
|
readConfigFile(pd / cfg)
|
||||||
|
|
||||||
if conf.projectName.len != 0:
|
if conf.projectName.len != 0:
|
||||||
# new project wide config file:
|
# new project wide config file:
|
||||||
var projectConfig = changeFileExt(conf.projectFull, "nimcfg")
|
var projectConfig = changeFileExt(conf.projectFull, "nimcfg")
|
||||||
if not fileExists(projectConfig):
|
if not fileExists(projectConfig):
|
||||||
projectConfig = changeFileExt(conf.projectFull, "nim.cfg")
|
projectConfig = changeFileExt(conf.projectFull, "nim.cfg")
|
||||||
readConfigFile(projectConfig, cache, conf)
|
readConfigFile(projectConfig)
|
||||||
|
|
||||||
|
for filename in configFiles:
|
||||||
|
rawMessage(conf, hintConf, filename)
|
||||||
|
|
||||||
proc loadConfigs*(cfg: string; conf: ConfigRef) =
|
proc loadConfigs*(cfg: string; conf: ConfigRef) =
|
||||||
# for backwards compatibility only.
|
# for backwards compatibility only.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue