Support async custom completion functions for AsyncParsableCommand via async/await#855
Conversation
b258097 to
5abed1e
Compare
|
Are there any changes that you would like for this PR? |
This should be detected at build time, if possible. There are a series of validators in the |
|
Thanks. I'll look into Validators soon, then add the check. |
613d0b2 to
a0a6d77
Compare
|
@natecook1000 I've added I've rebased on current main. Is there any way in the longterm to change SAP to run some or all of the If possible, I'll log an issue. |
a0a6d77 to
ed816dd
Compare
858faf7 to
75c00d6
Compare
| try parse(try self.asCommand.parseAsRoot(arguments)) | ||
| } | ||
|
|
||
| public static func parse( |
There was a problem hiding this comment.
@rgoldberg Is this intended to be public API? Could you add documentation to explain/show the intended use?
There was a problem hiding this comment.
Thanks for catching this. Sorry for overlooking it.
I just pushed a change that makes this internal instead of public (a new push after my recent rebase).
Is there any way to run various SAP CI checks locally other than using https://github.com/nektos/act, so I can avoid wasting your time?
If so, how? If not, I'll look into using act (I've heard of act, but haven't yet used it); if you have any act configuration for SAP, please let me know (and maybe it could be included in the repo).
Currently, I just run:
command Scripts/format.sh
swift testAm I missing anything?
Thanks.
I haven't written any build plugins, but from scanning the documentation it doesn't seem like an exact fit. A post-build plugin could be perfect, if such a thing existed? But if I'm wrong and there's a path to this, that would be great! |
Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
75c00d6 to
03a03b3
Compare
|
I think the build failures were because I needed to rebase on current main. Just pushed my rebase, so hopefully all checks should succeed now. I'll look into your review comments, then push updated code; I just wanted to push my rebase first (without having yet addressed your comments) so we could find any other issues that CI might detect. I've written one build plugin. It generated virtual Swift source before the rest of the code was compiled. I don't know all the options for build plugins; I'll try to take a cursory look, then get back to you, but it might be a bit before I can dedicate time to properly research. I don't know everything that Thanks for reviewing this. |
…a async/await. Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
03a03b3 to
8c0d240
Compare
|
If I need to do anything to fix the 2 CI failures, please let me know, & I'll fix things & resubmit. The failures look like Docker failures that seem likely outside the scope of my PR's changes, though. |
|
Those passed in previous runs – merging to unblock the next bits. Thanks, @rgoldberg! 👏🏻👏🏻👏🏻 |
|
Thanks for reviewing & merging. I will try to submit some fish shell improvements soon. I'll try to polish those up in time for 1.8.0. If Tool Info V1 is merged (see #817), I can update completions to use that instead of V0 to save you guys the work. |
DispatchSemaphore, so more modern standards compliant & will work for platforms that do not haveDispatchSemaphore.DispatchSemaphoreimplementation hangs when any async custom completions run if the root command is a syncParsableCommand; async custom completions do not hang because ofDispatchSemaphoreif the root command is anAsyncParsableCommand, regardless if the command containing the property for the completing argument is a syncParsableCommandor anAsyncParsableCommand.ParsableCommand.ParsableArguments#_errorLabelDocC (unrelated, but just noticed it should be improved).A few potential issues with / questions about what you want from this PR:
AsyncParsableCommandroot commands.ParsableCommand.ParsableCommandtoAsyncParsableCommand, since Swift Concurrency must be available, since the code is trying to use an async function for completion.ParsableCommand, aParserError.invalidStateis thrown during runtime when completion candidates are requested from an async custom completion function.Checklist