Skip to content

Conversation

rgoldberg
Copy link
Contributor

Add singleton to indicate which shell version is requesting completion candidates.

Create a String? singleton named CompletionShell.requestingVersion that indicates which shell version is requesting completion candidates.

It will be set to the correct value while a Swift custom completion function is executing to offer completions for a word from a command line (e.g., while customCompletion from @Option(completion: .custom(customCompletion)) executes). Otherwise, it will be set to nil.

The requesting shell version is communicated to the Swift app via an environment variable named SAP_SHELL_VERSION, which is exported by each of the generated completion scripts.

Improve some nearby DocC.

Resolve #689

Replace this paragraph with a description of your changes and rationale. Provide links to an existing issue or external references/discussions, if appropriate.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

…n candidates

Create a `String?` singleton named `CompletionShell.requestingVersion` that
indicates which shell version is requesting completion candidates.

It will be set to the correct value while a Swift custom completion function is
executing to offer completions for a word from a command line (e.g., while
`customCompletion` from `@Option(completion: .custom(customCompletion))`
executes). Otherwise, it will be set to `nil`.

The requesting shell version is communicated to the Swift app via an environment
variable named `SAP_SHELL_VERSION`, which is exported by each of the generated
completion scripts.

Improve some nearby DocC.

Resolve apple#689

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
@natecook1000
Copy link
Member

@swift-ci Please test

@natecook1000 natecook1000 merged commit 5f48a16 into apple:main Jan 22, 2025
2 checks passed
@rgoldberg rgoldberg deleted the 689-shell-version branch January 22, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indicate version of shell requesting completions
2 participants