PowerShell cmdlet completion improvements#266
Conversation
| let s = s.replace("\r\n", " ").replace('\n', " ").replace('\r', " "); | ||
| let s = s.replace("**", ""); | ||
| s.split_whitespace().collect::<Vec<_>>().join(" ") | ||
| } |
There was a problem hiding this comment.
Some light post-processing to make these easier to read. Eventually we should use FormattedTextElement to actually render the markdown.
| #[serde(alias = "Suggestions", default)] | ||
| pub suggestions: Vec<String>, | ||
| } | ||
|
|
There was a problem hiding this comment.
Needed for additional fallbacks for getting suggestions for parameters.
| ) | Where-Object {{ $_ }} | Sort-Object -Unique | ||
| }} }} | ||
| ) | ConvertTo-Json -Depth 8"# | ||
| )); |
There was a problem hiding this comment.
Here is the actual new fallback logic.
lucieleblanc
left a comment
There was a problem hiding this comment.
Thanks for all the improvements!
I have some questions about removing the flag aliases.
I'm also slightly worried about how this amount of new specs will affect bundle size, but maybe I'm misunderstanding how this works
| { | ||
| "name": [ | ||
| "-AssemblyName", | ||
| "-AN" |
There was a problem hiding this comment.
Just to confirm, the flag deletions are intentional?
There was a problem hiding this comment.
Eh it was but now I'm realizing it's not a good idea. That would break command x-ray when users use these aliases which I think is a regression. Pushed an update to restore the lost aliases.
| @@ -2,10 +2,7 @@ | |||
| "name": "Write-Verbose", | |||
| "options": [ | |||
| { | |||
| "name": [ | |||
| "-Message", | |||
| "-Msg" | |||
There was a problem hiding this comment.
Ditto -- is removing these aliases intentional?
|
@lucieleblanc Regarding the bundle size. The uncompressed size of the new specs around ~3MB.
|
Description
This PR contains several improvements to the auto-generated completion specs for PowerShell cmdlets.
The files
command-signatures/json/autogenerated/powershell/*.jsonare prodecedurally generated fromGet-Help. You can run that with:Changes
suggestionsfor options' arguments. I added some fallback cases which finds other sources for allowed values. I also started sorting these alphabetically for more deterministic outputs so the ordering has changed for some existing ones.The changes that are auto-generated are in their own commit so you can review actual source changes by looking at individual commits