Uploaded image for project: 'Swift'
  1. Swift
  2. SR-13567

`po String.Index` should print something human readable in lldb

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: LLDB for Swift
    • Labels:
      None
    • Environment:

      Xcode 11.6

      Description

      If you `po` or `p` a String.Index today, you get something like "_rawBits : 131072". This is very annoying when debugging code that manipulates strings. I think simply printing the `position` from those raw bits would be enough; ideally both the code-unit offset and the grapheme position, if those are available to String.Index. 

       

      I realize that I can use `encodedOffset` today to get the UTF-16 code unit offset, but that isn't ideal for non-ascii cases, or for when I'm printing the data type containing them, like Range<String.Index>. 

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            benpious Ben Pious
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: