mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Map line and column using the latest snapshot
During a cursor info request, the resolved offset was mapped to line and column using the buffer inside `SwiftDocumentSyntaxInfo`. However, prior to54683ca607, `editorReplaceText` was not updating the syntax info. This meant that snapshots would be more up to date than the buffer in the syntax info, allowing for the possibility of an invalid offset. While54683ca607would also fix this, snapshots actually have a `getLineAndColumn` anyway. Use that instead of grabbing the buffer from syntax info. Resolves rdar://78161348.
This commit is contained in:
@@ -639,7 +639,7 @@ static void mapLocToLatestSnapshot(
|
||||
}
|
||||
|
||||
std::tie(Location.Line, Location.Column) =
|
||||
EditorDoc->getLineAndColumnInBuffer(Location.Offset);
|
||||
LatestSnap->getBuffer()->getLineAndColumn(Location.Offset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user