summary refs log tree commit diff stats
path: root/compiler/nimsuggest
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-07 13:15:30 +0100
committerAraq <rumpf_a@web.de>2015-02-07 13:15:30 +0100
commitdc85c2498b2d555125510fe91905cd1beffb6d10 (patch)
tree31e48696e52de31a429c0194953ff34c5202f997 /compiler/nimsuggest
parent0b5c42f4050da85905c25633573617b91cd05229 (diff)
downloadNim-dc85c2498b2d555125510fe91905cd1beffb6d10.tar.gz
nimsuggest knows how to deal with files not belonging to the project
Diffstat (limited to 'compiler/nimsuggest')
-rw-r--r--compiler/nimsuggest/nimsuggest.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/nimsuggest/nimsuggest.nim b/compiler/nimsuggest/nimsuggest.nim
index 6edea06e5..cac078127 100644
--- a/compiler/nimsuggest/nimsuggest.nim
+++ b/compiler/nimsuggest/nimsuggest.nim
@@ -87,8 +87,9 @@ proc action(cmd: string) =
   i += skipWhile(cmd, seps, i)
   i += parseInt(cmd, col, i)
 
+  var isKnownFile = true
   if orig.len == 0: err()
-  let dirtyIdx = orig.fileInfoIdx
+  let dirtyIdx = orig.fileInfoIdx(isKnownFile)
 
   if dirtyfile.len != 0: msgs.setDirtyFile(dirtyIdx, dirtyfile)
   else: msgs.setDirtyFile(dirtyIdx, nil)
@@ -99,7 +100,10 @@ proc action(cmd: string) =
   gTrackPos = newLineInfo(dirtyIdx, line, col)
   #echo dirtyfile, gDirtyBufferIdx, " project ", gProjectMainIdx
   gErrorCounter = 0
-  compileProject()
+  if not isKnownFile:
+    compileProject(dirtyIdx)
+  else:
+    compileProject()
 
 proc serve() =
   # do not stop after the first error: