Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that our character offsets are in utf-16 code units #241522

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ declare module 'vscode' {
* The position will be {@link TextDocument.validatePosition adjusted}.
*
* @param position A position.
* @returns A valid zero-based offset.
* @returns A valid zero-based offset in UTF-16 [code units](https://developer.mozilla.org/en-US/docs/Glossary/Code_unit).
*/
offsetAt(position: Position): number;

/**
* Converts a zero-based offset to a position.
*
* @param offset A zero-based offset.
* @param offset A zero-based offset into the document. This offset is in UTF-16 [code units](https://developer.mozilla.org/en-US/docs/Glossary/Code_unit).
* @returns A valid {@link Position}.
*/
positionAt(offset: number): Position;
Expand Down Expand Up @@ -257,6 +257,8 @@ declare module 'vscode' {

/**
* The zero-based character value.
*
* Character offsets are expressed using UTF-16 [code units](https://developer.mozilla.org/en-US/docs/Glossary/Code_unit).
*/
readonly character: number;

Expand Down
Loading