Skip to content

Commit 2f74d65

Browse files
committedMay 11, 2016
Add notes about byte vs character offset
Closes terhechte#42.
1 parent f6793e5 commit 2f74d65

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
 

‎Protocol.org

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ The protocol uses simple HTTP GET calls for communication. The following endpoin
2222

2323
Request a completion. In order to successfuly complete the request, the server needs the following parameters as request headers:
2424

25-
=X-Offset=: An integer number of the current cursor position for which a completion is requested
26-
25+
=X-Offset=: An integer number of the current [[https://github.com/terhechte/SourceKittenDaemon/issues/42][byte offset]] for which a completion is requested
2726
=X-Path=: The path to the temporarily written buffer that contains the current state of the editing of the file
28-
2927
=X-File=: The name of the currently edited file as it is known in the project. I.e. ~AppDelegate.swift~
3028

3129
** /stop

‎Readme.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SourceKittenDaemon
2+
23
## Swift Auto Completion Helper
34

45
[![Travis][badge-travis]][travis]
@@ -55,7 +56,6 @@ You'll find a [zip file under the releases tab](https://github.com/terhechte/Sou
5556
Have a look at the [SwiftCode example project](https://github.com/terhechte/SourceKittenDaemon/tree/0.1.2/SwiftCode), or at the existing editor integrations (below). Alternatively, the communication
5657
protocol is outlined in the Protocol.org file in this repository.
5758

58-
5959
## Editor Integrations
6060

6161
### Emacs
@@ -84,6 +84,14 @@ This is a *very* simple editor and no sane person should try to write code with
8484
## Linux
8585
SourceKittenDaemon is not Linux-Ready yet, but I'll investigate this in the next days. Also, since it is very dependent upon the SourceKitten and Taylor frameworks, it won't work under Linux until those have been ported, too. The background daemon, SourceKitD, is available as Open Source via Apple's Swift repository.
8686

87+
## Troubleshooting
88+
89+
### Byte offset vs character offset
90+
91+
The `X-Offset` header takes a **byte offset** as opposed to a character
92+
offset. For most characters this will make no difference. However special
93+
characters such as `©` are counted as two bytes is
94+
UTF8. [See this issue for more details](https://github.com/terhechte/SourceKittenDaemon/issues/42).
8795

8896
## Thanks
8997
- A *lot* of thanks go to [Nathan Kot](https://github.com/nathankot) who wrote most parts of this.

0 commit comments

Comments
 (0)