nimsuggest: more precise cursor tracking

This commit is contained in:
Araq 2017-03-09 14:58:14 +01:00
commit 4755795416
24 changed files with 104 additions and 81 deletions

View file

@ -739,6 +739,8 @@ proc `??`* (info: TLineInfo, filename: string): bool =
const trackPosInvalidFileIdx* = -2 # special marker so that no suggestions
# are produced within comments and string literals
var gTrackPos*: TLineInfo
var gTrackPosAttached*: bool ## whether the tracking position was attached to some
## close token.
type
MsgFlag* = enum ## flags altering msgWriteln behavior
@ -863,6 +865,9 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) =
proc `==`*(a, b: TLineInfo): bool =
result = a.line == b.line and a.fileIndex == b.fileIndex
proc exactEquals*(a, b: TLineInfo): bool =
result = a.fileIndex == b.fileIndex and a.line == b.line and a.col == b.col
proc writeContext(lastinfo: TLineInfo) =
var info = lastinfo
for i in countup(0, len(msgContext) - 1):