Skip to content

fix(completion): protect astral Unicode caret and identifier boundaries - #177

Merged
sanskarIN merged 7 commits into
mainfrom
fix/unicode-astral-inline-boundaries-20261030
Oct 30, 2026
Merged

sanskarIN merged 7 commits into
mainfrom
fix/unicode-astral-inline-boundaries-20261030

Conversation

@sanskarIN

Copy link
Copy Markdown
Owner

User-visible issue

VS Code cursor columns are UTF-16 code-unit offsets, so a manual or automatic inline completion can be requested at a position between the halves of an emoji or non-BMP letter. Although context extraction trims orphaned halves from prompts, inserting completion text at that cursor could split the actual editor character. Separately, prefix-echo and suffix-overlap filtering treated surrogate halves as non-identifier punctuation and could truncate genuine non-BMP identifiers.

Implementation

  • Add a zero-allocation pure isSafeInsertionBoundary check: only valid UTF-16 line offsets outside surrogate pairs are eligible. Apply before any context collection, Ollama request, or manual/automatic response path.
  • Make prefix echo boundaries and suffix overlap guards compare whole Unicode scalar values rather than individual UTF-16 units, preserving true astral Unicode identifiers while still stripping unambiguous repeated code at punctuation boundaries.
  • Add deterministic regression cases across emoji, ZWJ sequences, Deseret letters, Hindi source, mixed ASCII/astral identifiers, fractional/invalid cursor positions, and safe suffix echoes.
  • Add a manual physical VS Code QA checklist at docs/qa/unicode-inline-boundary-acceptance.md, explicitly NOT RUN.

Gates and limitations

Full cross-platform CI, unit tests, Linux mocked editor-host integration, security audit and isolated VSIX candidate installation/upgrade must succeed before merge. There are no new network calls, model downloads, trained weights, repository indexes, publisher-ID changes, GitHub releases or registry publications. Physical editor and real Ollama model performance remain unverified.

@sanskarIN
sanskarIN merged commit aad30ae into main Oct 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant