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
+39Lines changed: 39 additions & 0 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`| Returns a list of completions. |
44
+
|`open`|`codecomplete.open`| Given a file will open a code-completion session which can be filtered using `codecomplete.update`. Each session must be closed using `codecomplete.close`. |
[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.codecomplete.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
+
```
77
+
57
78
### Response
58
79
59
80
```
@@ -75,6 +96,24 @@ completion-result ::=
75
96
}
76
97
```
77
98
99
+
```
100
+
completion.open-result ::=
101
+
{
102
+
<key.kind>: (UID) // UID for the declaration kind (function, class, etc.).
103
+
<key.name>: (string) // Name of the word being completed
104
+
<key.sourcetext>: (string) // Text to be inserted in source.
105
+
<key.description>: (string) // Text to be displayed in code-completion window.
106
+
<key.typename>: (string) // Text describing the type of the result.
107
+
<key.context>: (UID) // Semantic context of the code completion result.
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.
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
110
+
- <key.nameoffset> (int64) // The offset location of the given parameter
111
+
- <key.namelength> (int64) // The length of the given parameter
112
+
- <key.bodyoffset> (int64) // The `nameoffset` + the indentation inside the body of the file
113
+
- <key.bodylength> (int64) // The `namelength` + the indentation inside the body of the file
0 commit comments