ion-rust icon indicating copy to clipboard operation
ion-rust copied to clipboard

Implement the support for location metadata in the text buffer

Open desaikd opened this issue 10 months ago • 0 comments

Location metadata here means row and column values for the current text input of the buffer. It will be based on the offset value currently stored in the buffer and newline character counts (i.e. characters \r and \n).

Text buffer would need to do some book keeping based on the parameters specified above for properties row and previous newline byte offset. It needs to add access methods row() and column() where the row will just render the property row, whereas column will be based on current offset value and previous newline byte offset.

To implement this feature here are the list of changes required:

  • [x] Modify winnow parser methods for getting newline count
    • [x] match_whitespace0
    • [x] match_whitespace1
    • [x] match_text_until_unescaped
  • [x] Write unit tests to verify buffer properties row and column results into correct numbers

Reference WIP: https://github.com/amazon-ion/ion-rust/commit/2af4d3c21a083d62d8102d024dbc29be12098d2e

desaikd avatar Feb 05 '25 19:02 desaikd