PowerShell / PowerShell/vscode-powershell
Command Explorer doesn't sort like Show-Command
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 1.9k
- Fork
- 548
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The original intent behind Command Explorer was to mimic Show-Command. I noticed today that Show-Command sorts with the hyphens being of higher sort value than other letters. While the Sort-Object that we use in the Command Explorer seems to strip out the hyphens and sorts based on the result. So you'll see some Convert-Toxxx and then ConvertTo-yyy followed by Convert-Tozzz.
System Details
This happens with Windows PowerShell 5.1 on Windows 10 1709 and insiders build 18898 as well as PowerShell Core 6.2. As such, I'm going to forego the vscode version and PSES.
Issue Description
Example of 4 made up functions:
PS> function ConvertTo-Lkj {}
PS> function Convert-ToLkj {}
PS> function Convert-Lkj {}
PS> function ConvertLkj {}
When running Show-Command and then sorting for lkj:

When running the equivalent Get-Command code Get-Command *lkj | select name | Sort name | ogv:

I have also tested this in pwsh with the same behavior:
PS> function ConvertTo-Lkj {}
PS> function Convert-ToLkj {}
PS> function Convert-Lkj {}
PS> function ConvertLkj {}
PS> get-command *lkj | select name | sort name
Name
----
ConvertLkj
Convert-Lkj
ConvertTo-Lkj
Convert-ToLkj
Expected Behaviour
Output commands in the order:
Convert-Lkj
Convert-ToLkj
ConvertLkj
ConvertTo-Lkj
Actual Behaviour
Output commands in order:
ConvertLkj
Convert-Lkj
ConvertTo-Lkj
Convert-ToLkj
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando il percorso di ordinamento di Command Explorer e individuando il comportamento di Sort-Object descritto nell’issue. Riproduci i quattro nomi di comando di esempio, confronta il risultato con Show-Command e considera concluso il lavoro quando Command Explorer li ordina come mostrato in Expected Behaviour.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- powershell, typescript
- Ambito
- developer-experience, tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 42/100