New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SourceKit] docs for complete.open #5645
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4eced39
[SourceKit] Adds documentation for complete.open
Aghassi a1d77ee
[SourceKit] Added completion.open-result docs
Aghassi 29bf6a5
Reformatted documentation based on benlangmuir recs
Aghassi a2ffcfb
Swapped wrong definitions and corrected minor mistakes
Aghassi da61111
Fixed wording around codecomplete def
Aghassi File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
(`key.sourcetext`). `key.sourcefile` is ignored when `key.sourcetext` is also | ||
provided. | ||
|
||
| Request Name | Request Key | Description | | ||
| -------------:|:------------|:------------| | ||
| `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`.| | ||
| `open` | `codecomplete.open` | Open a code-completion session for the given input file and offset, and return the initial list of completions. | | ||
|
||
### Request | ||
|
||
``` | ||
|
@@ -54,6 +59,22 @@ provided. | |
} | ||
``` | ||
|
||
`codecomplete.open` | ||
``` | ||
{ | ||
<key.request>: (UID) <source.request.codecomplete.open> | ||
[opt] <key.sourcetext>: (string) // Source contents. | ||
[opt] <key.sourcefile>: (string) // Absolute path to the file. | ||
<key.offset>: (int64) // Byte offset of code-completion point inside the source contents. | ||
[opt] <key.options>: (dict) // An options dictionary containing keys. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
[opt] <key.compilerargs> [string*] // Array of zero or more strings for the compiler arguments, | ||
// e.g ["-sdk", "/path/to/sdk"]. If key.sourcefile is provided, | ||
// these must include the path to that file. | ||
[opt] <key.not_recommended> [bool] // True if this result is to be avoided, e.g. because | ||
// the declaration is unavailable. | ||
} | ||
``` | ||
|
||
### Response | ||
|
||
``` | ||
|
@@ -75,6 +96,24 @@ completion-result ::= | |
} | ||
``` | ||
|
||
``` | ||
completion.open-result ::= | ||
{ | ||
<key.kind>: (UID) // UID for the declaration kind (function, class, etc.). | ||
<key.name>: (string) // Name of the word being completed | ||
<key.sourcetext>: (string) // Text to be inserted in source. | ||
<key.description>: (string) // Text to be displayed in code-completion window. | ||
<key.typename>: (string) // Text describing the type of the result. | ||
<key.context>: (UID) // Semantic context of the code completion result. | ||
<key.num_bytes_to_erase>: (int64) // Number of bytes to the left of the cursor that should be erased before inserting this completion result. | ||
<key.substructure>: (dictionary) // Contains an array of dictionaries representing ranges of structural elements in the result description, such as the parameters of a function | ||
- <key.nameoffset> (int64) // The offset location of the given parameter | ||
- <key.namelength> (int64) // The length of the given parameter | ||
- <key.bodyoffset> (int64) // The `nameoffset` + the indentation inside the body of the file | ||
- <key.bodylength> (int64) // The `namelength` + the indentation inside the body of the file | ||
} | ||
``` | ||
|
||
### Testing | ||
|
||
``` | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a description of
codecomplete.open
.codecomplete
just returns completions and does not filter or create a session. Also, you could remove the word "upon" entirely.