Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions nimsuggest/nimsuggest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading