A DESCRIPTION OF THE PROBLEM :
When working with CodeArea, we need precise change information for offset calculations. For example, libraries like Tree-sitter require creating InputEdit objects with exact parameters (startByte, oldEndByte, newEndByte, startPoint, oldEndPoint, newEndPoint).
Currently, ContentChange provides change data in TextPos, making offset calculations very difficult because paragraph text is already modified when we process the change. The only workaround is saving full text versions and recalculating paragraph offsets for every change, which is highly inefficient.
I propose adding methods to ContentChange that would provide the necessary information for efficient offset calculation, such as: int getInsertedLength() and int getRemovedLength().
This would enable proper integration with parsing tools like Tree-sitter without performance penalties.
When working with CodeArea, we need precise change information for offset calculations. For example, libraries like Tree-sitter require creating InputEdit objects with exact parameters (startByte, oldEndByte, newEndByte, startPoint, oldEndPoint, newEndPoint).
Currently, ContentChange provides change data in TextPos, making offset calculations very difficult because paragraph text is already modified when we process the change. The only workaround is saving full text versions and recalculating paragraph offsets for every change, which is highly inefficient.
I propose adding methods to ContentChange that would provide the necessary information for efficient offset calculation, such as: int getInsertedLength() and int getRemovedLength().
This would enable proper integration with parsing tools like Tree-sitter without performance penalties.