make tests green again; disable periodic refresh for now

This commit is contained in:
Andreas Rumpf 2017-02-14 12:49:38 +01:00
commit bcecbc380f

View file

@ -13,11 +13,11 @@ import strutils, os, parseopt, parseutils, sequtils, net, rdstdin, sexp
# Do NOT import suggest. It will lead to wierd bugs with # Do NOT import suggest. It will lead to wierd bugs with
# suggestionResultHook, because suggest.nim is included by sigmatch. # suggestionResultHook, because suggest.nim is included by sigmatch.
# So we import that one instead. # So we import that one instead.
import compiler/options, compiler/commands, compiler/modules, compiler/sem, import compiler / [options, commands, modules, sem,
compiler/passes, compiler/passaux, compiler/msgs, compiler/nimconf, passes, passaux, msgs, nimconf,
compiler/extccomp, compiler/condsyms, compiler/lists, extccomp, condsyms, lists,
compiler/sigmatch, compiler/ast, compiler/scriptconfig, sigmatch, ast, scriptconfig,
compiler/idents, compiler/modulegraphs idents, modulegraphs, compilerlog]
when defined(windows): when defined(windows):
import winlean import winlean
@ -68,12 +68,6 @@ const
type type
EUnexpectedCommand = object of Exception EUnexpectedCommand = object of Exception
proc logStr(line: string) =
var f: File
if open(f, getHomeDir() / "nimsuggest.log", fmAppend):
f.writeLine(line)
f.close()
proc parseQuoted(cmd: string; outp: var string; start: int): int = proc parseQuoted(cmd: string; outp: var string; start: int): int =
var i = start var i = start
i += skipWhitespace(cmd, i) i += skipWhitespace(cmd, i)
@ -342,7 +336,7 @@ proc replEpc(x: ThreadParams) {.thread.} =
"unexpected call: " & epcAPI "unexpected call: " & epcAPI
quit errMessage quit errMessage
proc parseCmdLine(cmd: string; graph: ModuleGraph; cache: IdentCache) = proc execCmd(cmd: string; graph: ModuleGraph; cache: IdentCache) =
template sentinel() = template sentinel() =
# send sentinel for the input reading thread: # send sentinel for the input reading thread:
results.send(Suggest(section: ideNone)) results.send(Suggest(section: ideNone))
@ -394,8 +388,8 @@ proc parseCmdLine(cmd: string; graph: ModuleGraph; cache: IdentCache) =
sentinel() sentinel()
proc recompileFullProject(graph: ModuleGraph; cache: IdentCache) = proc recompileFullProject(graph: ModuleGraph; cache: IdentCache) =
echo "recompiling full project"
resetSystemArtifacts() resetSystemArtifacts()
#let graph = newGraph(oldgraph.config)
graph.resetAllModules() graph.resetAllModules()
compileProject(graph, cache) compileProject(graph, cache)
@ -416,12 +410,12 @@ proc mainThread(graph: ModuleGraph; cache: IdentCache) =
msgs.writelnHook = writelnHook msgs.writelnHook = writelnHook
suggestionResultHook = sugResultHook suggestionResultHook = sugResultHook
parseCmdLine(req, graph, cache) execCmd(req, graph, cache)
idle = 0 idle = 0
else: else:
os.sleep 250 os.sleep 250
idle += 1 idle += 1
if idle == 20: if idle == 20 and false:
# we use some nimsuggest activity to enable a lazy recompile: # we use some nimsuggest activity to enable a lazy recompile:
gIdeCmd = ideChk gIdeCmd = ideChk
msgs.writelnHook = proc (s: string) = discard msgs.writelnHook = proc (s: string) = discard
@ -436,14 +430,14 @@ proc serveStdin(graph: ModuleGraph; cache: IdentCache) {.deprecated.} =
echo DummyEof echo DummyEof
while true: while true:
let line = readLine(stdin) let line = readLine(stdin)
parseCmdLine line, graph, cache execCmd line, graph, cache
echo DummyEof echo DummyEof
flushFile(stdout) flushFile(stdout)
else: else:
echo Help echo Help
var line = "" var line = ""
while readLineFromStdin("> ", line): while readLineFromStdin("> ", line):
parseCmdLine line, graph, cache execCmd line, graph, cache
echo "" echo ""
flushFile(stdout) flushFile(stdout)
@ -461,7 +455,7 @@ proc serveTcp(graph: ModuleGraph; cache: IdentCache) {.deprecated.} =
accept(server, stdoutSocket) accept(server, stdoutSocket)
stdoutSocket.readLine(inp) stdoutSocket.readLine(inp)
parseCmdLine inp.string, graph, cache execCmd inp.string, graph, cache
stdoutSocket.send("\c\L") stdoutSocket.send("\c\L")
stdoutSocket.close() stdoutSocket.close()
@ -534,6 +528,9 @@ proc mainCommand(graph: ModuleGraph; cache: IdentCache) =
# do not stop after the first error: # do not stop after the first error:
msgs.gErrorMax = high(int) msgs.gErrorMax = high(int)
# compile the project before showing any input so that we already
# can answer questions right away:
compileProject(graph, cache)
open(requests) open(requests)
open(results) open(results)