nimsuggest: add option to force finding the project file (#12409)
This commit is contained in:
parent
7cf3395d85
commit
eeffa0163f
1 changed files with 10 additions and 1 deletions
|
|
@ -48,6 +48,7 @@ Options:
|
||||||
--maxresults:N limit the number of suggestions to N
|
--maxresults:N limit the number of suggestions to N
|
||||||
--tester implies --stdin and outputs a line
|
--tester implies --stdin and outputs a line
|
||||||
'""" & DummyEof & """' for the tester
|
'""" & DummyEof & """' for the tester
|
||||||
|
--find attempts to find the project file of the current project
|
||||||
|
|
||||||
The server then listens to the connection and takes line-based commands.
|
The server then listens to the connection and takes line-based commands.
|
||||||
|
|
||||||
|
|
@ -549,6 +550,7 @@ proc mainCommand(graph: ModuleGraph) =
|
||||||
|
|
||||||
proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) =
|
proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) =
|
||||||
var p = parseopt.initOptParser(cmd)
|
var p = parseopt.initOptParser(cmd)
|
||||||
|
var findProject = false
|
||||||
while true:
|
while true:
|
||||||
parseopt.next(p)
|
parseopt.next(p)
|
||||||
case p.kind
|
case p.kind
|
||||||
|
|
@ -594,6 +596,8 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) =
|
||||||
gRefresh = true
|
gRefresh = true
|
||||||
of "maxresults":
|
of "maxresults":
|
||||||
conf.suggestMaxResults = parseInt(p.val)
|
conf.suggestMaxResults = parseInt(p.val)
|
||||||
|
of "find":
|
||||||
|
findProject = true
|
||||||
else: processSwitch(pass, p, conf)
|
else: processSwitch(pass, p, conf)
|
||||||
of cmdArgument:
|
of cmdArgument:
|
||||||
let a = unixToNativePath(p.key)
|
let a = unixToNativePath(p.key)
|
||||||
|
|
@ -602,7 +606,12 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) =
|
||||||
# don't make it worse, report the error the old way:
|
# don't make it worse, report the error the old way:
|
||||||
if conf.projectName.len == 0: conf.projectName = a
|
if conf.projectName.len == 0: conf.projectName = a
|
||||||
else:
|
else:
|
||||||
conf.projectName = a
|
if findProject:
|
||||||
|
conf.projectName = findProjectNimFile(conf, a.parentDir())
|
||||||
|
if conf.projectName.len == 0:
|
||||||
|
conf.projectName = a
|
||||||
|
else:
|
||||||
|
conf.projectName = a
|
||||||
# if processArgument(pass, p, argsCount): break
|
# if processArgument(pass, p, argsCount): break
|
||||||
|
|
||||||
proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
|
proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue