fixes nimsuggest sug doesnt return anything on first pass #23283 (#23288)

fixes #23283
This commit is contained in:
Juan M Gómez
2024-02-15 15:23:15 +00:00
committed by GitHub
parent 35ec9c31bd
commit 92c8c6d5f4

View File

@@ -839,7 +839,7 @@ proc findSymDataInRange(graph: ModuleGraph, file: AbsoluteFile; startLine, start
proc markDirtyIfNeeded(graph: ModuleGraph, file: string, originalFileIdx: FileIndex) =
let sha = $sha1.secureHashFile(file)
if graph.config.m.fileInfos[originalFileIdx.int32].hash != sha or graph.config.ideCmd == ideSug:
if graph.config.m.fileInfos[originalFileIdx.int32].hash != sha or graph.config.ideCmd in {ideSug, ideCon}:
myLog fmt "{file} changed compared to last compilation"
graph.markDirty originalFileIdx
graph.markClientsDirty originalFileIdx
@@ -1000,7 +1000,6 @@ proc executeNoHooksV3(cmd: IdeCmd, file: AbsoluteFile, dirtyfile: AbsoluteFile,
conf.m.trackPosAttached = false
else:
conf.m.trackPos = default(TLineInfo)
if cmd != ideCon: #ideCon is recompiled below
graph.recompilePartially(fileIndex)
case cmd
@@ -1037,14 +1036,13 @@ proc executeNoHooksV3(cmd: IdeCmd, file: AbsoluteFile, dirtyfile: AbsoluteFile,
graph.recompileFullProject()
of ideChanged:
graph.markDirtyIfNeeded(file.string, fileIndex)
of ideSug:
# ideSug performs partial build of the file, thus mark it dirty for the
of ideSug, ideCon:
# ideSug/ideCon performs partial build of the file, thus mark it dirty for the
# future calls.
graph.markDirtyIfNeeded(file.string, fileIndex)
of ideCon:
graph.markDirty fileIndex
graph.markClientsDirty fileIndex
graph.recompilePartially(fileIndex)
graph.recompilePartially(fileIndex)
let m = graph.getModule fileIndex
incl m.flags, sfDirty
of ideOutline:
let n = parseFile(fileIndex, graph.cache, graph.config)
graph.iterateOutlineNodes(n, graph.fileSymbols(fileIndex).deduplicateSymInfoPair)