You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/SourceKit/docs/Protocol.md
+21-4Lines changed: 21 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,11 @@ must be given either the path to a file (`key.sourcefile`), or some text
38
38
(`key.sourcetext`). `key.sourcefile` is ignored when `key.sourcetext` is also
39
39
provided.
40
40
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
+
41
46
### Request
42
47
43
48
```
@@ -54,9 +59,21 @@ provided.
54
59
}
55
60
```
56
61
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. |
[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
+
```
60
77
61
78
### Response
62
79
@@ -89,7 +106,7 @@ completion.open-result ::=
89
106
<key.typename>: (string) // Text describing the type of the result.
90
107
<key.context>: (UID) // Semantic context of the code completion result.
91
108
<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
93
110
- <key.nameoffset> (int64) // The offset location of the given parameter
94
111
- <key.namelength> (int64) // The length of the given parameter
95
112
- <key.bodyoffset> (int64) // The `nameoffset` + the indentation inside the body of the file
0 commit comments