Add singleton to indicate which shell is requesting completion candidates#680
Conversation
bfe66ae to
21ead87
Compare
21ead87 to
30e0f78
Compare
|
@rauhul @natecook1000 What can I do to move this forward? Thanks. |
30e0f78 to
71458a1
Compare
|
@rauhul @natecook1000 Are there any changes that you'd like made to this PR? I'm happy to modify or completely redo this PR if you have a better way to indicate to Swift code which shell is requesting completions. Thanks for any guidance. |
…ates A CompletionShell singleton named CompletionShell.requesting has been created that indicates which shell is requesting completion candidates. The singleton is populated when a completion script is generated, so functions used to generate arguments for CompletionKind creation functions can return completion candidate syntax / shell commands tailored for that shell. For the custom(:) CompletionKind creation function, the singleton is populated at runtime (when a completion script requests completions from the Swift app after a user types tab while composing a command line to call the app). The requesting shell is communicated to the Swift app via an environment variable named SAP_SHELL, which is exported by each of the generated completion scripts. Resolve apple#672 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
71458a1 to
1941bb6
Compare
|
Is there any way to get feedback on this PR so I can modify it however you prefer (if you want changes), then get it approved & merged? |
natecook1000
left a comment
There was a problem hiding this comment.
Apologies for the delay, @rgoldberg! Thanks so much for both identifying the issue and building a source-compatible fix. I have just one note about the documentation; otherwise, this looks great to merge.
|
|
||
| /// An instance representing the shell for which completions are being | ||
| /// requested. | ||
| public internal(set) static var requesting: CompletionShell? |
There was a problem hiding this comment.
Could you add a note to the documentation that this is only non-nil while generating shell scripts and custom completions?
|
@swift-ci Please test |
Resolve apple#672 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
|
@natecook1000 No problem about the delay. Sorry if I pestered. Thanks for the feedback. While I have your attention, can I ask you for feedback about #679 (comment)? I have a WIP PR that improves completion scripts in many ways, but I want to ensure that I support all versions of the shells that you want to be supported. It will take me a little while to finish that PR, but it's definitely progressed a long way. Thanks again. |
|
@swift-ci Please test |
…ariable. Resolve apple#672 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
|
@natecook1000 Any way to kick off the tests again? Once this is merged, I will submit my PR for #689. In a few weeks or so, I will submit my PR for #679. Thanks for the help. |
|
@swift-ci Please test |
|
@rgoldberg Merged, thank you! |
Add singleton to indicate which shell is requesting completion candidates.
A
CompletionShellsingleton namedCompletionShell.requestinghas been created that indicates which shell is requesting completion candidates.The singleton is populated when a completion script is generated, so functions used to generate arguments for
CompletionKindcreation functions can read the singleton to be able to return completion candidates / shell commands tailored for the requesting shell.For the
custom(:)CompletionKindcreation function, the singleton is populated at runtime (when a completion script requests completions from the Swift app after a user types tab while composing a command line to call the app).The requesting shell is communicated to the Swift app via an environment variable named
SAP_SHELL, which is exported by each of the generated completion scripts.Resolve #672
Checklist