-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'staleContent' error in highlighter #23
Comments
Will it make sense to call func textStorage(_ textStorage: NSTextStorage, willProcessEditing editedMask: NSTextStorageEditActions, range editedRange: NSRange, changeInLength delta: Int) {
if editedMask.contains(.editedCharacters) {
treeSitterClient.willChangeContent(in: editedRange)
}
}
func textStorage(_ textStorage: NSTextStorage, didProcessEditing editedMask: NSTextStorageEditActions, range editedRange: NSRange, changeInLength delta: Int) {
guard editedMask.contains(.editedCharacters) else { return }
let adjustedRange = NSRange(location: editedRange.location, length: editedRange.length - delta)
let string = textStorage.string
highlighter.didChangeContent(in: adjustedRange, delta: delta)
treeSitterClient.didChangeContent(to: string, in: adjustedRange, delta: delta, limit: string.utf16.count)
} |
I think it is safe to ignore edits if they only contain attribute changes. But, I have experimented with this in the past and have run into issues - I just cannot remember why... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am getting an error while updating the font size of textview
The error says
failed to get tokens: staleContent
Tried debugging and noticed that the issue does not occur in the Example project. While comparing the stack side by side by putting breakpoints on the line which prints error, it seems like the guard comparison fails on the following line
Neon/Sources/TreeSitterClient/TreeSitterClient.swift
Line 350 in 4bc0fe4
In debugger startedVersion = 2 and self.version = 3. What could be the probable reason?
The code works fine despite the error
The text was updated successfully, but these errors were encountered: