summary refs log tree commit diff stats
path: root/nimsuggest/nimsuggest.nim
diff options
context:
space:
mode:
authorJuan M Gómez <info@jmgomez.me>2024-02-15 15:23:15 +0000
committerGitHub <noreply@github.com>2024-02-15 16:23:15 +0100
commit92c8c6d5f4e5a96b71bf4eca5f6a136410f97d6e (patch)
treeaa190d733d8208b11d73e95eb5b71118860c5b95 /nimsuggest/nimsuggest.nim
parent35ec9c31bd0bd413f1740feea90f3b97ad5d1b65 (diff)
downloadNim-92c8c6d5f4e5a96b71bf4eca5f6a136410f97d6e.tar.gz
fixes nimsuggest sug doesnt return anything on first pass #23283 (#23288)
fixes #23283
Diffstat (limited to 'nimsuggest/nimsuggest.nim')
-rw-r--r--nimsuggest/nimsuggest.nim14
1 files changed, 6 insertions, 8 deletions
diff --git a/nimsuggest/nimsuggest.nim b/nimsuggest/nimsuggest.nim
index 64d2dedc8..e69731b27 100644
--- a/nimsuggest/nimsuggest.nim
+++ b/nimsuggest/nimsuggest.nim
@@ -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)