Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8357405

Add text length metrics to ContentChange for removed/inserted text for CodeArea

XMLWordPrintable

    • generic
    • generic

      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.


            angorya Andy Goryachev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: