Minor tweaks to position encoding

This commit is contained in:
Dirk Baeumer 2022-04-13 15:08:10 +02:00
parent e82164123d
commit 3bd6feecca
No known key found for this signature in database
GPG key ID: DD95715335E91385
2 changed files with 10 additions and 13 deletions

View file

@ -1,4 +1,4 @@
- name: "Base Protocol JSON structures"
- name: "Linkable Types"
children:
- type: 'integer'
link: '#integer'
@ -24,17 +24,12 @@
link: '#errorCodes'
- type: 'NotificationMessage'
link: '#notificationMessage'
- name: "$ Notifications and Requests"
children:
- type: 'CancelParams'
link: '#cancelRequest'
- type: 'ProgressParams'
link: '#progress'
- type: 'ProgressToken'
link: '#progress'
- name: "Basic JSON Structures"
children:
- type: 'Uri'
link: '#uri'
- type: 'URI'
@ -49,6 +44,8 @@
link: '#textDocuments'
- type: 'Position'
link: '#position'
- type: 'PositionEncodingKind'
link: '#positionEncodingKind'
- type: 'Range'
link: '#range'
- type: 'Location'
@ -137,9 +134,6 @@
link: '#partialResultParams'
- type: 'TraceValue'
link: '#traceValue'
- name: "Actual Protocol"
children:
- type: 'InitializeParams'
link: '#initializeParams'
- type: 'InitializeResult'

View file

@ -21,9 +21,12 @@ interface Position {
```
When describing positions the protocol needs to specify how offsets (specifically character offsets) should be interpreted.
The corresponding `PostionEncodingKind` is negotiated between the client and the server during initialization.
The corresponding `PositionEncodingKind` is negotiated between the client and the server during initialization.
```typscript
<div class="anchorHolder"><a href="#positionEncodingKind" name="positionEncodingKind" class="linkableAnchor"></a></div>
```typescript
/**
* A type indicating how positions are encoded,
* specifically what column offsets mean.
@ -49,10 +52,10 @@ export namespace PositionEncodingKind {
export const UTF16: PositionEncodingKind = 'utf-16';
/**
* Character offsets count UTF-32 code units.
* Character offsets count UTF-32 code units.
*
* Implementation note: these are the same as Unicode code points,
* so this `PositionEncodingKind` may also be used for an
* so this `PositionEncodingKind` may also be used for an
* encoding-agnostic representation of character offsets.
*/
export const UTF32: PositionEncodingKind = 'utf-32';