Connection
Base URL, credentials and a reachable server.
OffsetIlex gives editor-offset code a focused project conversation. Review how a compatible model handles non-BMP characters and boundary positions before connecting proposed changes to a UTF-16-based API.
def utf16_offsets(text):
if type(text) is not str or len(text) > 4096:
raise ValueError("bounded text")
offsets = [0]
for char in text:
value = ord(char)
if 0xD800 <= value <= 0xDFFF:
raise ValueError("unpaired surrogate")
offsets.append(offsets[-1] + (2 if value > 0xFFFF else 1))
return offsetsBase URL, credentials and a reachable server.
Test emoji and combining marks, rejecting isolated surrogate code points without normalizing the text.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
def utf16_offsets(text):
if type(text) is not str or len(text) > 4096:
raise ValueError("bounded text")
offsets = [0]
for char in text:
value = ord(char)
if 0xD800 <= value <= 0xDFFF:
raise ValueError("unpaired surrogate")
offsets.append(offsets[-1] + (2 if value > 0xFFFF else 1))
return offsetsAn editor integration can highlight the wrong character even when both components agree on the text. The disagreement may be about what a position counts. OffsetIlex provides a Windows AI coding workspace for tracing that boundary between your source strings and an API that expects a different indexing convention.
For a UTF-16 offset task, show the connected model text containing a character outside the basic multilingual plane and the expected boundary positions. Ask it to inspect the conversion helper and its caller together. Make clear whether incoming positions count code points or code units, since changing a helper without changing its interpretation can create another mismatch.
Review invalid text and end-of-string behavior as part of the same patch. A boundary map should have a defined meaning at the end as well as between characters, and the application needs a policy for unsupported surrogate input. Run focused fixtures through the actual integration and compare the selected ranges, not merely the helper’s array length.
OffsetIlex supports configured OpenAI-compatible or Anthropic endpoints. An available uncensored AI model can help investigate the source, with context capacity and tools determined by the server. Use representative synthetic text when possible, then review the proposed edits against the editor API contract before keeping them.
Use a short string with ordinary characters and one character represented by a UTF-16 surrogate pair. Mark the expected boundaries explicitly. This makes a code-point versus code-unit disagreement visible without a large document.
No. A user-perceived character can involve multiple code points, while UTF-16 counts code units. State which convention each component uses. Ask the model to trace the actual API boundary instead of treating these notions as interchangeable.
Selections and insertions may end at the end of the string. Check that the map represents that position and that callers use it consistently. Testing only the first character can miss an off-by-one integration error.
Choose an explicit policy consistent with the helper and its consumers. The illustrated context rejects unsupported surrogate values. Review that rejection path and the caller’s response rather than silently substituting text during an offset conversion.
OffsetIlex · Updated 2026-10-25