Skip to content

Commit 29bf6a5

Browse files
committed
Reformatted documentation based on benlangmuir recs
1 parent a1d77ee commit 29bf6a5

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

tools/SourceKit/docs/Protocol.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ must be given either the path to a file (`key.sourcefile`), or some text
3838
(`key.sourcetext`). `key.sourcefile` is ignored when `key.sourcetext` is also
3939
provided.
4040

41+
| Request Name | Request Key | Description |
42+
| -------------:|:------------|:------------|
43+
| `codecomplete` | `codecomplete` | Given a file will open a code-completion session which can be filtered upon using `codecomplete.update`. Each session must be closed using `codecomplete.close`.|
44+
| `open` | `codecomplete.open` | Open a code-completion session for the given input file and offset, and return the initial list of completions. |
45+
4146
### Request
4247

4348
```
@@ -54,9 +59,21 @@ provided.
5459
}
5560
```
5661

57-
| Request Name | Request Key | Description |
58-
| -------------:|:------------|:------------|
59-
| `open` | `complete.open` | Given an input file, will determine at each offset what keyword is possible. Default offset is `0` if none is provided. |
62+
`codecomplete.open`
63+
```
64+
{
65+
<key.request>: (UID) <source.request.codecomplete.open>
66+
[opt] <key.sourcetext>: (string) // Source contents.
67+
[opt] <key.sourcefile>: (string) // Absolute path to the file.
68+
<key.offset>: (int64) // Byte offset of code-completion point inside the source contents.
69+
[opt] <key.options>: (dict) // An options dictionary containing keys.
70+
[opt] <key.compilerargs> [string*] // Array of zero or more strings for the compiler arguments,
71+
// e.g ["-sdk", "/path/to/sdk"]. If key.sourcefile is provided,
72+
// these must include the path to that file.
73+
[opt] <key.not_recommended> [bool] // True if this result is to be avoided, e.g. because
74+
// the declaration is unavailable.
75+
}
76+
```
6077

6178
### Response
6279

@@ -89,7 +106,7 @@ completion.open-result ::=
89106
<key.typename>: (string) // Text describing the type of the result.
90107
<key.context>: (UID) // Semantic context of the code completion result.
91108
<key.num_bytes_to_erase>: (int64) // Number of bytes to the left of the cursor that should be erased before inserting this completion result.
92-
<key.substructure>: (dictionary) // Can contains an array the `nameoffset`, `namelength`, `bodyoffset`, `bodylength`, and `substructure`. Other `substructure` will exist if the code complete represents a function. Each one is a paramater of the function
109+
<key.substructure>: (dictionary) // Contains an array of dictionaries representing ranges of structural elements in the result description, such as the parameters of a function
93110
- <key.nameoffset> (int64) // The offset location of the given parameter
94111
- <key.namelength> (int64) // The length of the given parameter
95112
- <key.bodyoffset> (int64) // The `nameoffset` + the indentation inside the body of the file

0 commit comments

Comments
 (0)