Skip to content
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 5 commits into from Nov 14, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/SourceKit/docs/Protocol.md
Expand Up @@ -40,8 +40,8 @@ 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. |
| `codecomplete` | `codecomplete` | Open a code-completion session for the given input file and offset, and return the initial list of completions. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codecomplete does not open a session. It just returns completions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, to clarify, codecomplete would be defined as "Returns completions given an input file and offeset". Does that mean (for my own understanding) it opens a session internally and closes it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstractly you could sort of think of it that way, but it doesn't really work that way. The "session" for the requests open/close/update is really a way of storing the results we get back from code-completion in the compiler and manipulating them. Code-complete just returns the results and is done.

| `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`. |

### Request

Expand All @@ -66,7 +66,7 @@ provided.
[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.
[opt] <key.codecomplete.options>: (dict) // An options dictionary containing keys.
[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.
Expand Down