microsoft / microsoft/winget-cli

auto complete does not automatically enable after install `winget` with Microsoft Store

Open
#1,430 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

Don't auto complete automatically enable after install winget with Microsoft Store

Steps to reproduce

  1. Install winget from Microsoft Store
  2. Open Windows terminal (PowerShell)
  3. Write winget and then click repeated presses of tab (⇥)
  4. PowerShell does not show any command or meaningful suggestion, instead of showing file and folder

Expected behavior

I expect after install winget from Microsoft Store, and open Windows Terminal (PowerShell) I can use auto-complete without need any further steps.

Actual behavior

auto-complete does not work automatically.

Environment

Windows Package Manager v1.0.11692
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19043.1202
Package: Microsoft.DesktopAppInstaller v1.12.11692.0

Workaround

I have to add below command manually to my profile from WinGet Command Line Tab Completion

Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
    param($wordToComplete, $commandAst, $cursorPosition)
        [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
        $Local:word = $wordToComplete.Replace('"', '""')
        $Local:ast = $commandAst.ToString().Replace('"', '""')
        winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
            [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
        }
}

After close all PowerShell and reopen that, this work correctly

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with doc/Completion.md and the PowerShell completion setup described there, then trace how the Microsoft Store installation exposes the winget command. Reproduce the behavior in Windows Terminal with PowerShell and compare it with the documented manual registration. Done means completion is available after installation without manually editing the PowerShell profile.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, powershell
Domain
cli, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.