nimsuggest knows how to deal with files not belonging to the project
This commit is contained in:
parent
0b5c42f405
commit
dc85c2498b
2 changed files with 12 additions and 3 deletions
|
|
@ -522,7 +522,7 @@ proc newFileInfo(fullPath, projPath: string): TFileInfo =
|
||||||
if optEmbedOrigSrc in gGlobalOptions or true:
|
if optEmbedOrigSrc in gGlobalOptions or true:
|
||||||
result.lines = @[]
|
result.lines = @[]
|
||||||
|
|
||||||
proc fileInfoIdx*(filename: string): int32 =
|
proc fileInfoIdx*(filename: string; isKnownFile: var bool): int32 =
|
||||||
var
|
var
|
||||||
canon: string
|
canon: string
|
||||||
pseudoPath = false
|
pseudoPath = false
|
||||||
|
|
@ -539,11 +539,16 @@ proc fileInfoIdx*(filename: string): int32 =
|
||||||
if filenameToIndexTbl.hasKey(canon):
|
if filenameToIndexTbl.hasKey(canon):
|
||||||
result = filenameToIndexTbl[canon]
|
result = filenameToIndexTbl[canon]
|
||||||
else:
|
else:
|
||||||
|
isKnownFile = false
|
||||||
result = fileInfos.len.int32
|
result = fileInfos.len.int32
|
||||||
fileInfos.add(newFileInfo(canon, if pseudoPath: filename
|
fileInfos.add(newFileInfo(canon, if pseudoPath: filename
|
||||||
else: canon.shortenDir))
|
else: canon.shortenDir))
|
||||||
filenameToIndexTbl[canon] = result
|
filenameToIndexTbl[canon] = result
|
||||||
|
|
||||||
|
proc fileInfoIdx*(filename: string): int32 =
|
||||||
|
var dummy: bool
|
||||||
|
result = fileInfoIdx(filename, dummy)
|
||||||
|
|
||||||
proc newLineInfo*(fileInfoIdx: int32, line, col: int): TLineInfo =
|
proc newLineInfo*(fileInfoIdx: int32, line, col: int): TLineInfo =
|
||||||
result.fileIndex = fileInfoIdx
|
result.fileIndex = fileInfoIdx
|
||||||
result.line = int16(line)
|
result.line = int16(line)
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,9 @@ proc action(cmd: string) =
|
||||||
i += skipWhile(cmd, seps, i)
|
i += skipWhile(cmd, seps, i)
|
||||||
i += parseInt(cmd, col, i)
|
i += parseInt(cmd, col, i)
|
||||||
|
|
||||||
|
var isKnownFile = true
|
||||||
if orig.len == 0: err()
|
if orig.len == 0: err()
|
||||||
let dirtyIdx = orig.fileInfoIdx
|
let dirtyIdx = orig.fileInfoIdx(isKnownFile)
|
||||||
|
|
||||||
if dirtyfile.len != 0: msgs.setDirtyFile(dirtyIdx, dirtyfile)
|
if dirtyfile.len != 0: msgs.setDirtyFile(dirtyIdx, dirtyfile)
|
||||||
else: msgs.setDirtyFile(dirtyIdx, nil)
|
else: msgs.setDirtyFile(dirtyIdx, nil)
|
||||||
|
|
@ -99,6 +100,9 @@ proc action(cmd: string) =
|
||||||
gTrackPos = newLineInfo(dirtyIdx, line, col)
|
gTrackPos = newLineInfo(dirtyIdx, line, col)
|
||||||
#echo dirtyfile, gDirtyBufferIdx, " project ", gProjectMainIdx
|
#echo dirtyfile, gDirtyBufferIdx, " project ", gProjectMainIdx
|
||||||
gErrorCounter = 0
|
gErrorCounter = 0
|
||||||
|
if not isKnownFile:
|
||||||
|
compileProject(dirtyIdx)
|
||||||
|
else:
|
||||||
compileProject()
|
compileProject()
|
||||||
|
|
||||||
proc serve() =
|
proc serve() =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue