Comments (2)
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...
from neon.
Will it make sense to call treeSitterClient.willChangeContent
and treeSitterClient.didChangeContent
only when edited mask contains editedCharacters
?
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)
}
from neon.
Related Issues (17)
- Variable 'version' needs fix HOT 2
- async version of currentTree HOT 1
- Cannot invalidate highlight at startup and/or with manual text settings HOT 4
- Proposal : TextViewSystemInterface to class HOT 9
- Crash on async access HOT 2
- Coalesce attribute changes into one block HOT 2
- Direct text storage attribute modifications HOT 13
- SwiftUI example HOT 7
- Rendering HTML HOT 3
- Repo example code returns nil for highlight method HOT 6
- Demo crashes when editing text HOT 9
- Validation/Invalidation coordination problem with TreeSitterClient and TextSystemStyler HOT 2
- Text highlighting after edit does not work HOT 1
- TextStorageSystemInterface does not style textedits that are not at end of string HOT 2
- Crash on Updating Text from updateNSView(_ view: NSTextView, context: Context) HOT 7
- Screenshot link for "painting it black" in README broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neon.