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

Add singleton to indicate which shell is requesting completion candidates #680

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rgoldberg
Copy link
Contributor

@rgoldberg rgoldberg commented Nov 1, 2024

Add singleton to indicate which shell is requesting completion candidates.

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 read the singleton to be able to return completion candidates / shell commands tailored for the requesting 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 #672

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

@rgoldberg rgoldberg force-pushed the 672-completion-per-shell branch 2 times, most recently from bfe66ae to 21ead87 Compare November 1, 2024 13:47
…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 <[email protected]>
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.

Custom completion per shell (zsh, bash, or fish)
1 participant