nimfind: improvements
This commit is contained in:
parent
6e003eeecb
commit
9eb9a57ffd
1 changed files with 6 additions and 3 deletions
|
|
@ -77,6 +77,7 @@ proc createDb(db: DbConn) =
|
||||||
foreign key (nimid) references syms(nimid)
|
foreign key (nimid) references syms(nimid)
|
||||||
);
|
);
|
||||||
""")
|
""")
|
||||||
|
db.exec sql"create index if not exists UsagesIx on usages(file, line);"
|
||||||
|
|
||||||
proc toDbFileId*(db: DbConn; conf: ConfigRef; fileIdx: FileIndex): int =
|
proc toDbFileId*(db: DbConn; conf: ConfigRef; fileIdx: FileIndex): int =
|
||||||
if fileIdx == FileIndex(-1): return -1
|
if fileIdx == FileIndex(-1): return -1
|
||||||
|
|
@ -166,7 +167,9 @@ proc mainCommand(graph: ModuleGraph) =
|
||||||
add(conf.searchPaths, conf.libpath)
|
add(conf.searchPaths, conf.libpath)
|
||||||
# do not stop after the first error:
|
# do not stop after the first error:
|
||||||
conf.errorMax = high(int)
|
conf.errorMax = high(int)
|
||||||
|
try:
|
||||||
compileProject(graph)
|
compileProject(graph)
|
||||||
|
finally:
|
||||||
close(FinderRef(graph.backend).db)
|
close(FinderRef(graph.backend).db)
|
||||||
performSearch(conf, dbfile)
|
performSearch(conf, dbfile)
|
||||||
|
|
||||||
|
|
@ -194,7 +197,7 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) =
|
||||||
if conf.projectName.len == 0: conf.projectName = info[0]
|
if conf.projectName.len == 0: conf.projectName = info[0]
|
||||||
try:
|
try:
|
||||||
conf.m.trackPos = newLineInfo(conf, AbsoluteFile info[0],
|
conf.m.trackPos = newLineInfo(conf, AbsoluteFile info[0],
|
||||||
parseInt(info[1]), parseInt(info[2]))
|
parseInt(info[1]), parseInt(info[2])-1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
quit "invalid command line"
|
quit "invalid command line"
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue